Merge remote-tracking branch 'origin/master' into features/edit-accompanying-period-social-work

This commit is contained in:
2021-06-25 21:26:21 +02:00
25 changed files with 644 additions and 78 deletions

View File

@@ -2,6 +2,7 @@
namespace Chill\PersonBundle\Controller;
use Chill\ActivityBundle\Entity\Activity;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
@@ -75,7 +76,7 @@ class AccompanyingCourseController extends Controller
return $this->redirectToRoute('chill_person_accompanying_course_edit', [
'accompanying_period_id' => $period->getId()
]);
}
/**
@@ -96,9 +97,15 @@ class AccompanyingCourseController extends Controller
}
}
$activities = $this->getDoctrine()->getManager()->getRepository(Activity::class)->findBy(
['accompanyingPeriod' => $accompanyingCourse],
['date' => 'DESC'],
);
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
'accompanyingCourse' => $accompanyingCourse,
'withoutHousehold' => $withoutHousehold
'withoutHousehold' => $withoutHousehold,
'activities' => $activities
]);
}

View File

@@ -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;
}
/**