mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix bug issue 163 Address JSON string not valid
This commit is contained in:
parent
4e6454d7de
commit
ac47a75a75
@ -297,18 +297,16 @@ class PersonAddressController extends AbstractController
|
||||
*/
|
||||
protected function findAddressById(Person $person, $address_id)
|
||||
{
|
||||
// filtering address
|
||||
$criteria = Criteria::create()
|
||||
->where(Criteria::expr()->eq('id', $address_id))
|
||||
->setMaxResults(1);
|
||||
$addresses = $person->getAddresses()->matching($criteria);
|
||||
$address = $this->getDoctrine()->getManager()
|
||||
->getRepository(Address::class)
|
||||
->find($address_id)
|
||||
;
|
||||
|
||||
if (count($addresses) === 0) {
|
||||
throw $this->createNotFoundException("Address with id $address_id "
|
||||
. "matching person $person_id not found ");
|
||||
if (!$person->getAddresses()->contains($address)) {
|
||||
throw $this->createAccessDeniedException("Not allowed to see this address");
|
||||
}
|
||||
|
||||
return $addresses->first();
|
||||
return $address;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user