Elcodi\Fixtures\DataFixtures\ORM\Customer\CustomerData::load PHP Method

load() public method

Load data fixtures with the passed EntityManager
public load ( Doctrine\Common\Persistence\ObjectManager $manager )
$manager Doctrine\Common\Persistence\ObjectManager
    public function load(ObjectManager $manager)
    {
        /**
         * @var $homeAddress AddressInterface
         */
        $homeAddress = $this->getReference('address-home');
        /**
         * @var $workAddress AddressInterface
         */
        $workAddress = $this->getReference('address-work');
        /**
         * @var CustomerInterface $customer
         */
        $customer = $this->getFactory('customer')->create()->setPassword('1234')->setEmail('[email protected]')->setFirstName('Homer')->setLastName('Simpson')->setGender(ElcodiUserProperties::GENDER_MALE)->addAddress($homeAddress)->addAddress($workAddress)->setEnabled(true);
        $manager->persist($customer);
        $this->addReference('customer', $customer);
        /**
         * @var CustomerInterface $anotherCustomer
         */
        $anotherCustomer = $this->getFactory('customer')->create()->setPassword('1234')->setEmail('[email protected]')->setFirstName('Santa')->setLastName('Claus')->setGender(ElcodiUserProperties::GENDER_FEMALE)->setEnabled(true);
        $manager->persist($anotherCustomer);
        $this->addReference('another-customer', $anotherCustomer);
        $manager->flush();
    }