public function testOwners() { $entity = new Group(); $user = new User(); $this->assertEmpty($entity->getOwner()); $entity->setOwner($user); $this->assertEquals($user, $entity->getOwner()); }
public function load(ObjectManager $manager) { $entityManager = $this->container->get('doctrine.orm.entity_manager'); $saleUser = $this->getUser($manager, 'sale'); $groups = array('Behavioural Segmentation' => $saleUser, 'Demographic Segmentation' => $this->getUser($manager, 'marketing'), 'Geographic Segmentation' => $saleUser, 'Segmentation by occasions' => $saleUser, 'Segmentation by benefits' => $saleUser); foreach ($groups as $group => $user) { $contactGroup = new Group($group); $contactGroup->setOwner($user); $contactGroup->setOrganization($this->getReference('default_organization')); $entityManager->persist($contactGroup); } $entityManager->flush(); }