public function setType($type) { if ($type instanceof Type) { $this->setIndex($type->getIndex()); $type = $type->getName(); } return $this->setParam('_type', $type); }