/** * Test related method */ public function testConstruct() { $this->assertEntity($this->type); $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $this->type->getGroups()); $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $this->type->getTranslations()); $this->assertCount(0, $this->type->getGroups()); $this->assertCount(0, $this->type->getTranslations()); }
/** * Remove a group type * @param GroupType $groupType * * @AclAncestor("pim_enrich_group_type_remove") * @return Response|RedirectResponse */ public function removeAction(GroupType $groupType) { if ($groupType->isVariant()) { throw new DeleteException($this->getTranslator()->trans('flash.group type.cant remove variant')); } elseif (count($groupType->getGroups()) > 0) { throw new DeleteException($this->getTranslator()->trans('flash.group type.cant remove used')); } else { $this->remove($groupType); } if ($this->getRequest()->isXmlHttpRequest()) { return new Response('', 204); } else { return $this->redirectToRoute('pim_enrich_group_type_index'); } }
/** * {@inheritDoc} */ public function getGroups() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getGroups', array()); return parent::getGroups(); }