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)
|
protected function findAddressById(Person $person, $address_id)
|
||||||
{
|
{
|
||||||
// filtering address
|
$address = $this->getDoctrine()->getManager()
|
||||||
$criteria = Criteria::create()
|
->getRepository(Address::class)
|
||||||
->where(Criteria::expr()->eq('id', $address_id))
|
->find($address_id)
|
||||||
->setMaxResults(1);
|
;
|
||||||
$addresses = $person->getAddresses()->matching($criteria);
|
|
||||||
|
|
||||||
if (count($addresses) === 0) {
|
if (!$person->getAddresses()->contains($address)) {
|
||||||
throw $this->createNotFoundException("Address with id $address_id "
|
throw $this->createAccessDeniedException("Not allowed to see this address");
|
||||||
. "matching person $person_id not found ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $addresses->first();
|
return $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user