public function addType($type) { if ($type instanceof ElasticaType) { $type = $type->getName(); } elseif (empty($type) && !is_numeric($type)) { // A type can be 0, but cannot be empty return $this; } $this->_params['type'][] = $type; return $this; }