mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge remote-tracking branch 'origin/master' into features/household-validation
This commit is contained in:
commit
0e1bbbfee9
@ -72,7 +72,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
$loader->load('services/command.yaml');
|
$loader->load('services/command.yaml');
|
||||||
$loader->load('services/actions.yaml');
|
$loader->load('services/actions.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
$loader->load('services/templating.yaml');
|
|
||||||
$loader->load('services/alt_names.yaml');
|
$loader->load('services/alt_names.yaml');
|
||||||
$loader->load('services/household.yaml');
|
$loader->load('services/household.yaml');
|
||||||
// We can get rid of this file when the service 'chill.person.repository.person' is no more used.
|
// We can get rid of this file when the service 'chill.person.repository.person' is no more used.
|
||||||
|
@ -5,9 +5,10 @@ namespace Chill\PersonBundle\Templating\Entity;
|
|||||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use RuntimeException;
|
||||||
use Symfony\Component\Templating\EngineInterface;
|
use Symfony\Component\Templating\EngineInterface;
|
||||||
|
|
||||||
class SocialIssueRender implements ChillEntityRenderInterface
|
final class SocialIssueRender implements ChillEntityRenderInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
private EngineInterface $engine;
|
private EngineInterface $engine;
|
||||||
@ -28,11 +29,14 @@ class SocialIssueRender implements ChillEntityRenderInterface
|
|||||||
{
|
{
|
||||||
return $entity instanceof SocialIssue;
|
return $entity instanceof SocialIssue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SocialIssue $socialIssue
|
||||||
|
*/
|
||||||
public function renderString($socialIssue, array $options): string
|
public function renderString($socialIssue, array $options): string
|
||||||
{
|
{
|
||||||
/** @var $socialIssue SocialIssue */
|
/** @var $socialIssue SocialIssue */
|
||||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||||
|
|
||||||
$str = $this->translatableStringHelper->localize($socialIssue->getTitle());
|
$str = $this->translatableStringHelper->localize($socialIssue->getTitle());
|
||||||
|
|
||||||
@ -46,26 +50,36 @@ class SocialIssueRender implements ChillEntityRenderInterface
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildParents($socialIssue): array
|
protected function buildParents(SocialIssue $socialIssue): array
|
||||||
{
|
{
|
||||||
$parents = [];
|
$parents = [];
|
||||||
|
|
||||||
while ($socialIssue->hasParent()) {
|
while ($socialIssue->hasParent()) {
|
||||||
$socialIssue = $parents[] = $socialIssue->getParent();
|
$socialIssue = $parents[] = $socialIssue->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parents;
|
return $parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param SocialIssue $socialIssue
|
||||||
|
*/
|
||||||
public function renderBox($socialIssue, array $options): string
|
public function renderBox($socialIssue, array $options): string
|
||||||
{
|
{
|
||||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||||
// give some help to twig: an array of parents
|
// give some help to twig: an array of parents
|
||||||
$parents = $this->buildParents($socialIssue);
|
$parents = $this->buildParents($socialIssue);
|
||||||
|
|
||||||
return $this->engine->render('@ChillPerson/Entity/social_issue.html.twig', [
|
return $this
|
||||||
'socialIssue' => $socialIssue,
|
->engine
|
||||||
'parents' => $parents,
|
->render(
|
||||||
'options' => $options
|
'@ChillPerson/Entity/social_issue.html.twig',
|
||||||
]);
|
[
|
||||||
|
'socialIssue' => $socialIssue,
|
||||||
|
'parents' => $parents,
|
||||||
|
'options' => $options
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
parameters:
|
parameters:
|
||||||
# cl_chill_person.example.class: Chill\PersonBundle\Example
|
# cl_chill_person.example.class: Chill\PersonBundle\Example
|
||||||
|
|
||||||
services:
|
services:
|
||||||
_defaults:
|
_defaults:
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
@ -63,7 +63,16 @@ services:
|
|||||||
resource: '../Repository/'
|
resource: '../Repository/'
|
||||||
tags: ['doctrine.repository_service']
|
tags: ['doctrine.repository_service']
|
||||||
|
|
||||||
|
|
||||||
Chill\PersonBundle\Controller\:
|
Chill\PersonBundle\Controller\:
|
||||||
autowire: true
|
autowire: true
|
||||||
resource: '../Controller/'
|
resource: '../Controller/'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\PersonBundle\Templating\Entity\:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
resource: '../Templating/Entity'
|
||||||
|
tags:
|
||||||
|
- 'chill.render_entity'
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
services:
|
|
||||||
Chill\PersonBundle\Templating\Entity\:
|
|
||||||
resource: '../../Templating/Entity'
|
|
||||||
tags:
|
|
||||||
- 'chill.render_entity'
|
|
||||||
|
|
||||||
Chill\PersonBundle\Templating\Entity\PersonRender:
|
|
||||||
arguments:
|
|
||||||
$configAltNamesHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
|
|
||||||
$engine: '@Symfony\Component\Templating\EngineInterface'
|
|
||||||
tags:
|
|
||||||
- 'chill.render_entity'
|
|
||||||
|
|
||||||
Chill\PersonBundle\Templating\Entity\ClosingMotiveRender:
|
|
||||||
arguments:
|
|
||||||
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
|
|
||||||
tags:
|
|
||||||
- 'chill.render_entity'
|
|
||||||
|
|
||||||
Chill\PersonBundle\Templating\Entity\SocialIssueRender:
|
|
||||||
arguments:
|
|
||||||
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
|
|
||||||
$engine: '@Symfony\Component\Templating\EngineInterface'
|
|
||||||
tags:
|
|
||||||
- 'chill.render_entity'
|
|
Loading…
x
Reference in New Issue
Block a user