/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $address = new Address(); $address->setStreetName('gertrudes'); $address->setStreetNumber(100); $address->setLatitude(56.948043); $address->setLongitude(24.139537); $manager->persist($address); $manager->flush(); }
public function testAdd() { $address = new Address(); $address->setStreetName('stabu'); $address->setStreetNumber(50); $address->setLatitude(56.954611); $address->setLongitude(24.131838); $this->em->persist($address); $this->em->flush(); /** @var Address */ $addressRetrieved = $this->em->getRepository('AppBundle:Address')->createQueryBuilder('a')->andWhere('a.streetName = :streetName AND a.streetNumber = :streetNumber')->setParameter('streetName', 'stabu')->setParameter('streetNumber', 50)->getQuery()->getOneOrNullResult(); $this->assertInstanceOf('AppBundle\\Entity\\Address', $address); $this->assertEquals('stabu', $addressRetrieved->getStreetName()); $this->assertEquals(50, $addressRetrieved->getStreetNumber()); }