/** * "Success" form handler * * @param Address $entity */ protected function onSuccess(Address $entity) { if (null === $entity->getOrganization()) { $entity->setOrganization($this->organization); } $this->manager->persist($entity); $this->manager->flush(); }
/** * @param $region * @param $country * * @return MagentoAddress */ protected function createMagentoAddress($region, $country) { $address = new MagentoAddress(); $address->setRegion($region); $address->setCountry($country); $address->setCity('City'); $address->setStreet('street'); $address->setPostalCode(123456); $address->setFirstName('John'); $address->setLastName('Doe'); $address->setLabel('label'); $address->setPrimary(true); $address->setOrganization('oro'); $address->setOriginId(1); $address->setOrganization($this->organization); $this->em->persist($address); return $address; }