public function load(ObjectManager $manager)
 {
     $representative = new Representative();
     $representative->setFirstName('Joseph');
     $representative->setLastName('Biden');
     $representative->setUsername('JosephBiden');
     $representative->setOfficialTitle('Vice President');
     $representative->setCity('Washington');
     $representative->setOfficialAddress('1600 Pennsylvania Avenue NW');
     $representative->setOfficialPhone('');
     $representative->setEmail('*****@*****.**');
     $representative->setDistrict($this->getReference('district_us'));
     $representative->setRepresentativeStorage($this->getReference('vice_president'));
     $this->addReference('vice_president_representative', $representative);
     $manager->persist($representative);
     $manager->flush($representative);
 }
 public function load(ObjectManager $manager)
 {
     // Create representative
     /** @var $representative Representative */
     $representative = new Representative();
     $representative->setFirstName(self::REPRESENTATIVE_NAME);
     $representative->setLastName(self::REPRESENTATIVE_NAME);
     $representative->setUsername(self::REPRESENTATIVE_NAME);
     $representative->setOfficialTitle(self::REPRESENTATIVE_TITLE);
     $representative->setOfficialAddress(self::REPRESENTATIVE_ADDRESS);
     $representative->setOfficialPhone(self::REPRESENTATIVE_PHONE);
     $representative->setEmail(self::REPRESENTATIVE_EMAIL);
     $representative->setCountry(self::REPRESENTATIVE_COUNTRY);
     $representative->setCity(self::REPRESENTATIVE_CITY);
     $representative->setDistrict($this->getReference('district_us'));
     //encode password according configuration
     $factory = $this->container->get('security.encoder_factory');
     $encoder = $factory->getEncoder($representative);
     $password = $encoder->encodePassword(self::REPRESENTATIVE_PASSWORD, $representative->getSalt());
     $representative->setPassword($password);
     $this->addReference('representative1', $representative);
     $manager->persist($representative);
     $manager->flush();
 }
 public function setLastName($name)
 {
     $this->__load();
     return parent::setLastName($name);
 }