Merge branch 'notifications3' into 'master'

Notifications3

See merge request Chill-Projet/chill-bundles!89
This commit is contained in:
Marc Ducobu
2021-07-22 17:44:37 +00:00
18 changed files with 319 additions and 7 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace Chill\PersonBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\DataFixtures\ORM\LoadAbstractNotificationsTrait;
use Chill\PersonBundle\DataFixtures\ORM\LoadAccompanyingPeriod;
/**
* Load notififications into database
*/
class LoadAccompanyingPeriodNotifications extends AbstractFixture implements DependentFixtureInterface
{
use LoadAbstractNotificationsTrait;
public $notifs = [
[
'message' => 'Hello !',
'entityClass' => AccompanyingPeriod::class,
'entityRef' => LoadAccompanyingPeriod::ACCOMPANYING_PERIOD,
'sender' => 'center a_social',
'addressees' => [
'center a_social',
'center a_administrative',
'center a_direction',
'multi_center'
],
]
];
public function getDependencies()
{
return [
LoadAccompanyingPeriod::class,
];
}
}

View File

@@ -74,6 +74,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$loader->load('services/form.yaml');
$loader->load('services/alt_names.yaml');
$loader->load('services/household.yaml');
$loader->load('services/notification.yaml');
// We can get rid of this file when the service 'chill.person.repository.person' is no more used.
// We should use the PersonRepository service instead of a custom service name.
$loader->load('services/repository.yaml');

View File

@@ -0,0 +1,24 @@
<?php
namespace Chill\PersonBundle\Notification;
use Chill\MainBundle\Entity\Notification;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
final class AccompanyingPeriodNotificationRenderer
{
public function supports(Notification $notification)
{
return $notification->getRelatedEntityClass() == AccompanyingPeriod::class;
}
public function getTemplate()
{
return 'ChillPersonBundle:AccompanyingPeriod:showInNotification.html.twig';
}
public function getTemplateData(Notification $notification)
{
return ['notification' => $notification];
}
}

View File

@@ -0,0 +1,3 @@
<a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': notification.relatedEntityId }) }}">
Go to Acc. period.
</a>

View File

@@ -0,0 +1,3 @@
services:
Chill\PersonBundle\Notification\AccompanyingPeriodNotificationRenderer:
autowire: true