public function testOrganization() { $entity = new Group(); $organization = new Organization(); $this->assertNull($entity->getOrganization()); $entity->setOrganization($organization); $this->assertSame($organization, $entity->getOrganization()); }
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(); }