mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
form acc work edit: save action
This commit is contained in:
parent
981b9299ad
commit
0afe277b04
@ -35,6 +35,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|||||||
use Symfony\Component\Form\CallbackTransformer;
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||||
|
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||||
|
|
||||||
class ActivityType extends AbstractType
|
class ActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
@ -46,6 +47,10 @@ class ActivityType extends AbstractType
|
|||||||
|
|
||||||
protected TranslatableStringHelper $translatableStringHelper;
|
protected TranslatableStringHelper $translatableStringHelper;
|
||||||
|
|
||||||
|
protected SocialIssueRender $socialIssueRender;
|
||||||
|
|
||||||
|
protected SocialActionRender $socialActionRender;
|
||||||
|
|
||||||
protected array $timeChoices;
|
protected array $timeChoices;
|
||||||
|
|
||||||
public function __construct (
|
public function __construct (
|
||||||
@ -54,7 +59,8 @@ class ActivityType extends AbstractType
|
|||||||
ObjectManager $om,
|
ObjectManager $om,
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
array $timeChoices,
|
array $timeChoices,
|
||||||
SocialIssueRender $socialIssueRender
|
SocialIssueRender $socialIssueRender,
|
||||||
|
SocialActionRender $socialActionRender
|
||||||
) {
|
) {
|
||||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||||
throw new \RuntimeException("you should have a valid user");
|
throw new \RuntimeException("you should have a valid user");
|
||||||
@ -66,6 +72,7 @@ class ActivityType extends AbstractType
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->timeChoices = $timeChoices;
|
$this->timeChoices = $timeChoices;
|
||||||
$this->socialIssueRender = $socialIssueRender;
|
$this->socialIssueRender = $socialIssueRender;
|
||||||
|
$this->socialActionRender = $socialActionRender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
@ -124,7 +131,7 @@ class ActivityType extends AbstractType
|
|||||||
'required' => $activityType->isRequired('socialActions'),
|
'required' => $activityType->isRequired('socialActions'),
|
||||||
'class' => SocialAction::class,
|
'class' => SocialAction::class,
|
||||||
'choice_label' => function (SocialAction $socialAction) {
|
'choice_label' => function (SocialAction $socialAction) {
|
||||||
return $this->translatableStringHelper->localize($socialAction->getTitle());
|
return $this->socialActionRender->renderString($socialAction, []);
|
||||||
},
|
},
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
||||||
|
@ -32,6 +32,7 @@ services:
|
|||||||
- "@chill.main.helper.translatable_string"
|
- "@chill.main.helper.translatable_string"
|
||||||
- "%chill_activity.form.time_duration%"
|
- "%chill_activity.form.time_duration%"
|
||||||
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
||||||
|
- '@Chill\PersonBundle\Templating\Entity\SocialActionRender'
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_activitybundle_activity }
|
- { name: form.type, alias: chill_activitybundle_activity }
|
||||||
|
|
||||||
|
@ -8,6 +8,11 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\MainBundle\CRUD\Resolver\Resolver;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class AbstractCRUDController extends AbstractController
|
class AbstractCRUDController extends AbstractController
|
||||||
{
|
{
|
||||||
@ -248,4 +253,24 @@ class AbstractCRUDController extends AbstractController
|
|||||||
{
|
{
|
||||||
return $this->get('validator');
|
return $this->get('validator');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getSubscribedServices(): array
|
||||||
|
{
|
||||||
|
return \array_merge(
|
||||||
|
parent::getSubscribedServices(),
|
||||||
|
[
|
||||||
|
'chill_main.paginator_factory' => PaginatorFactory::class,
|
||||||
|
|
||||||
|
'translator' => TranslatorInterface::class,
|
||||||
|
AuthorizationHelper::class => AuthorizationHelper::class,
|
||||||
|
EventDispatcherInterface::class => EventDispatcherInterface::class,
|
||||||
|
Resolver::class => Resolver::class,
|
||||||
|
SerializerInterface::class => SerializerInterface::class,
|
||||||
|
'validator' => ValidatorInterface::class,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class SocialIssueApiController extends ApiController
|
||||||
|
{
|
||||||
|
protected function customizeQuery(string $action, Request $request, $query): void
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$query->expr()->orX(
|
||||||
|
$query->expr()->gt('e.desactivationDate', ':now'),
|
||||||
|
$query->expr()->isNull('e.desactivationDate')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$query->setParameter('now', new \DateTimeImmutable());
|
||||||
|
}
|
||||||
|
}
|
@ -488,6 +488,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
[
|
[
|
||||||
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class,
|
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class,
|
||||||
'name' => 'social_work_social_issue',
|
'name' => 'social_work_social_issue',
|
||||||
|
'controller' => \Chill\PersonBundle\Controller\SocialIssueApiController::class,
|
||||||
'base_path' => '/api/1.0/person/social-work/social-issue',
|
'base_path' => '/api/1.0/person/social-work/social-issue',
|
||||||
'base_role' => 'ROLE_USER',
|
'base_role' => 'ROLE_USER',
|
||||||
'actions' => [
|
'actions' => [
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
<div>
|
<div>
|
||||||
<div @click="removeGoal(g)" class="objective-title">
|
<div @click="removeGoal(g)" class="objective-title">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
{{ g.title.fr }}
|
{{ g.goal.title.fr }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<add-result destination="goal" :goal="g"></add-result>
|
<add-result destination="goal" :goal="g.goal"></add-result>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -145,21 +145,47 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<add-persons
|
<add-persons
|
||||||
buttonTitle="Ajouter des tiers"
|
buttonTitle="Ajouter des tiers"
|
||||||
modalTitle="Choisir des tiers"
|
modalTitle="Choisir des tiers"
|
||||||
v-bind:key="thirdPartyPicker.key"
|
v-bind:key="thirdPartyPicker.key"
|
||||||
v-bind:options="thirdPartyPicker.options"
|
v-bind:options="thirdPartyPicker.options"
|
||||||
@addNewPersons="addThirdParties"
|
@addNewPersons="addThirdParties"
|
||||||
ref="thirdPartyPicker"> <!-- to cast child method -->
|
ref="thirdPartyPicker"> <!-- to cast child method -->
|
||||||
</add-persons>
|
</add-persons>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="errors" v-if="errors.length > 0">
|
||||||
|
<p>Veuillez corriger les erreurs suivantes:</p>
|
||||||
|
<ul>
|
||||||
|
<li v-for="e in errors">{{ e }}</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li v-if="!isPosting">
|
||||||
|
<button
|
||||||
|
class="sc-button bt-save"
|
||||||
|
@click="submit"
|
||||||
|
>
|
||||||
|
{{ $t('action.save') }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li v-if="isPosting">
|
||||||
|
<button
|
||||||
|
class="sc-button bt-save"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
{{ $t('action.save') }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@ -174,6 +200,7 @@
|
|||||||
"persons persons"
|
"persons persons"
|
||||||
"handling handling"
|
"handling handling"
|
||||||
"tparties tparties"
|
"tparties tparties"
|
||||||
|
"errors errors"
|
||||||
;
|
;
|
||||||
|
|
||||||
grid-template-columns: 50%;
|
grid-template-columns: 50%;
|
||||||
@ -293,6 +320,9 @@
|
|||||||
#thirdParties {
|
#thirdParties {
|
||||||
grid-area: tparties;
|
grid-area: tparties;
|
||||||
}
|
}
|
||||||
|
#errors {
|
||||||
|
grid-area: errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -314,9 +344,9 @@ const i18n = {
|
|||||||
action_title: "Action d'accompagnement",
|
action_title: "Action d'accompagnement",
|
||||||
startDate: "Date de début",
|
startDate: "Date de début",
|
||||||
endDate: "Date de fin",
|
endDate: "Date de fin",
|
||||||
results_without_objective: "Résultats sans objectifs",
|
results_without_objective: "Résultats - orientations sans objectifs",
|
||||||
add_objectif: "Ajouter un motif - objectif - dispositif",
|
add_objectif: "Ajouter un motif - objectif - dispositif",
|
||||||
persons_involved: "Usagers concernés",
|
persons_involved: "Usagers concernés",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -360,7 +390,9 @@ export default {
|
|||||||
'goalsPicked',
|
'goalsPicked',
|
||||||
'personsReachables',
|
'personsReachables',
|
||||||
'handlingThirdParty',
|
'handlingThirdParty',
|
||||||
'thirdParties'
|
'thirdParties',
|
||||||
|
'isPosting',
|
||||||
|
'errors',
|
||||||
]),
|
]),
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'hasResultsForAction',
|
'hasResultsForAction',
|
||||||
@ -390,11 +422,11 @@ export default {
|
|||||||
return this.$store.state.note;
|
return this.$store.state.note;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
this.$store.commit('setNote', note);
|
this.$store.commit('setNote', v);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
availableForCheckGoal() {
|
availableForCheckGoal() {
|
||||||
let pickedIds = this.$store.state.goalsPicked.map(g => g.id);
|
let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id);
|
||||||
console.log('pickeds goals id', pickedIds);
|
console.log('pickeds goals id', pickedIds);
|
||||||
console.log(this.$store.state.goalsForAction);
|
console.log(this.$store.state.goalsForAction);
|
||||||
|
|
||||||
@ -445,6 +477,9 @@ export default {
|
|||||||
console.log('remove third party', t);
|
console.log('remove third party', t);
|
||||||
this.$store.commit('removeThirdParty', t);
|
this.$store.commit('removeThirdParty', t);
|
||||||
},
|
},
|
||||||
|
submit() {
|
||||||
|
this.$store.dispatch('submit');
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="noResult" v-if="!hasResult">
|
<div class="noResult" v-if="!hasResult">
|
||||||
<div class="chill-no-data-statement">
|
<div class="chill-no-data-statement">
|
||||||
{{ $t('goal_has_ho_result') }}
|
{{ $t('goal_has_no_result') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,6 +25,7 @@ const store = createStore({
|
|||||||
.map(p => p.person),
|
.map(p => p.person),
|
||||||
handlingThirdParty: window.accompanyingCourseWork.handlingThierParty,
|
handlingThirdParty: window.accompanyingCourseWork.handlingThierParty,
|
||||||
thirdParties: window.accompanyingCourseWork.thirdParties,
|
thirdParties: window.accompanyingCourseWork.thirdParties,
|
||||||
|
isPosting: false,
|
||||||
errors: [],
|
errors: [],
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
@ -40,7 +41,7 @@ const store = createStore({
|
|||||||
return founds === undefined ? [] : founds;
|
return founds === undefined ? [] : founds;
|
||||||
},
|
},
|
||||||
resultsPickedForGoal: (state) => (goal) => {
|
resultsPickedForGoal: (state) => (goal) => {
|
||||||
let found = state.goalsPicked.find(g => g.id === goal.id);
|
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||||
|
|
||||||
return found === undefined ? [] : found.results;
|
return found === undefined ? [] : found.results;
|
||||||
},
|
},
|
||||||
@ -50,6 +51,43 @@ const store = createStore({
|
|||||||
hasThirdParties(state) {
|
hasThirdParties(state) {
|
||||||
return state.thirdParties.length > 0;
|
return state.thirdParties.length > 0;
|
||||||
},
|
},
|
||||||
|
buildPayload(state) {
|
||||||
|
return {
|
||||||
|
type: 'accompanying_period_work',
|
||||||
|
id: state.work.id,
|
||||||
|
startDate: {
|
||||||
|
datetime: datetimeToISO(state.startDate)
|
||||||
|
},
|
||||||
|
endDate: state.endDate === null ? null : {
|
||||||
|
datetime: datetimeToISO(state.endDate)
|
||||||
|
},
|
||||||
|
note: state.note,
|
||||||
|
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
|
||||||
|
handlingThierParty: state.handlingThirdParty === null ? null : {
|
||||||
|
id: state.handlingThirdParty.id,
|
||||||
|
type: state.handlingThirdParty.type
|
||||||
|
},
|
||||||
|
results: state.resultsPicked.map(r => ({id: r.id, type: r.type})),
|
||||||
|
thirdParties: state.thirdParties.map(t => ({id: t.id, type: t.type})),
|
||||||
|
goals: state.goalsPicked.map(g => {
|
||||||
|
let o = {
|
||||||
|
type: g.type,
|
||||||
|
note: g.note,
|
||||||
|
goal: {
|
||||||
|
type: g.goal.type,
|
||||||
|
id: g.goal.id,
|
||||||
|
},
|
||||||
|
results: g.results.map(r => ({id: r.id, type: r.type})),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g.id !== undefined) {
|
||||||
|
o.id = g.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return o;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setStartDate(state, date) {
|
setStartDate(state, date) {
|
||||||
@ -79,16 +117,23 @@ const store = createStore({
|
|||||||
state.resultsPicked = state.resultsPicked.filter(r => r.id !== result.id);
|
state.resultsPicked = state.resultsPicked.filter(r => r.id !== result.id);
|
||||||
},
|
},
|
||||||
addGoal(state, goal) {
|
addGoal(state, goal) {
|
||||||
let g = goal;
|
let g = {
|
||||||
// initialize results to empty array
|
type: "accompanying_period_work_goal",
|
||||||
g.results = []
|
goal: goal,
|
||||||
|
note: '',
|
||||||
|
results: []
|
||||||
|
}
|
||||||
state.goalsPicked.push(g);
|
state.goalsPicked.push(g);
|
||||||
},
|
},
|
||||||
removeGoal(state, goal) {
|
removeGoal(state, goal) {
|
||||||
state.goalsPicked = state.goalsPicked.filter(g => g.id !== goal.id);
|
state.goalsPicked = state.goalsPicked.filter(g => g.id !== goal.id);
|
||||||
},
|
},
|
||||||
addResultForGoalPicked(state, { goal, result}) {
|
addResultForGoalPicked(state, { goal, result}) {
|
||||||
let found = state.goalsPicked.find(g => g.id === goal.id);
|
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||||
|
console.log('adResultForGoalPicked');
|
||||||
|
console.log('found', found);
|
||||||
|
console.log('goal', goal);
|
||||||
|
console.log('result', result);
|
||||||
|
|
||||||
if (found === undefined) {
|
if (found === undefined) {
|
||||||
return;
|
return;
|
||||||
@ -97,7 +142,7 @@ const store = createStore({
|
|||||||
found.results.push(result);
|
found.results.push(result);
|
||||||
},
|
},
|
||||||
removeResultForGoalPicked(state, { goal, result}) {
|
removeResultForGoalPicked(state, { goal, result}) {
|
||||||
let found = state.goalsPicked.find(g => g.id === goal.id);
|
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||||
|
|
||||||
if (found === undefined) {
|
if (found === undefined) {
|
||||||
return;
|
return;
|
||||||
@ -130,11 +175,12 @@ const store = createStore({
|
|||||||
state.thirdParties = state.thirdParties
|
state.thirdParties = state.thirdParties
|
||||||
.filter(t => t.id !== thirdParty.id);
|
.filter(t => t.id !== thirdParty.id);
|
||||||
},
|
},
|
||||||
addErrors(state, errors) {
|
setErrors(state, errors) {
|
||||||
console.log('handling errors', errors);
|
console.log('handling errors', errors);
|
||||||
for (let i in errors) {
|
state.errors = errors;
|
||||||
state.push(errors[i]);
|
},
|
||||||
}
|
setIsPosting(state, st) {
|
||||||
|
state.isPosting = st;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -206,6 +252,46 @@ const store = createStore({
|
|||||||
commit('setResultsForAction', data.results);
|
commit('setResultsForAction', data.results);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
submit({ getters, state, commit }) {
|
||||||
|
let
|
||||||
|
payload = getters.buildPayload,
|
||||||
|
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json`,
|
||||||
|
errors = []
|
||||||
|
;
|
||||||
|
|
||||||
|
console.log('action subitting', payload, url);
|
||||||
|
commit('setIsPosting', true);
|
||||||
|
|
||||||
|
window.fetch(url, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload)
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok || response.status === 422) {
|
||||||
|
return response.json().then(data => ({data, status: response.status}));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(response.status);
|
||||||
|
}).then(({data, status}) => {
|
||||||
|
if (status === 422) {
|
||||||
|
for (let i in data.violations) {
|
||||||
|
errors.push(data.violations[i].title);
|
||||||
|
}
|
||||||
|
commit('setErrors', errors);
|
||||||
|
commit('setIsPosting', false);
|
||||||
|
} else {
|
||||||
|
console.info('nothing to do here, bye bye');
|
||||||
|
window.location.assign(`/fr/person/accompanying-period/${state.work.accompanyingPeriod.id}/work`);
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
commit('setErrors', [
|
||||||
|
'Erreur serveur ou réseau: veuillez ré-essayer. Code erreur: ' + e
|
||||||
|
]);
|
||||||
|
commit('setIsPosting', false);
|
||||||
|
});
|
||||||
|
},
|
||||||
initAsync({ dispatch }) {
|
initAsync({ dispatch }) {
|
||||||
dispatch('getReachablesResultsForAction');
|
dispatch('getReachablesResultsForAction');
|
||||||
dispatch('getReachablesGoalsForAction');
|
dispatch('getReachablesGoalsForAction');
|
||||||
|
@ -33,17 +33,18 @@ class SocialActionRender implements ChillEntityRenderInterface
|
|||||||
{
|
{
|
||||||
/** @var $socialAction SocialAction */
|
/** @var $socialAction SocialAction */
|
||||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||||
|
$titles[] = $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||||
$str = $this->translatableStringHelper->localize($socialAction->getTitle());
|
|
||||||
|
|
||||||
while ($socialAction->hasParent()) {
|
while ($socialAction->hasParent()) {
|
||||||
$socialAction = $socialAction->getParent();
|
$socialAction = $socialAction->getParent();
|
||||||
$str .= $options[self::SEPARATOR_KEY].$this->translatableStringHelper->localize(
|
$titles[] = $this->translatableStringHelper->localize(
|
||||||
$socialAction->getTitle()
|
$socialAction->getTitle()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
$titles = \array_reverse($titles);
|
||||||
|
|
||||||
|
return \implode($options[self::SEPARATOR_KEY], $titles);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildParents($socialAction): array
|
protected function buildParents($socialAction): array
|
||||||
|
@ -38,16 +38,20 @@ final class SocialIssueRender implements ChillEntityRenderInterface
|
|||||||
/** @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());
|
$titles[] = $this->translatableStringHelper
|
||||||
|
->localize($socialIssue->getTitle());
|
||||||
|
|
||||||
|
// loop to parent, until root
|
||||||
while ($socialIssue->hasParent()) {
|
while ($socialIssue->hasParent()) {
|
||||||
$socialIssue = $socialIssue->getParent();
|
$socialIssue = $socialIssue->getParent();
|
||||||
$str .= $options[self::SEPARATOR_KEY].$this->translatableStringHelper->localize(
|
$titles[] = $this->translatableStringHelper->localize(
|
||||||
$socialIssue->getTitle()
|
$socialIssue->getTitle()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
$titles = \array_reverse($titles);
|
||||||
|
|
||||||
|
return \implode($options[self::SEPARATOR_KEY], $titles);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildParents(SocialIssue $socialIssue): array
|
protected function buildParents(SocialIssue $socialIssue): array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user