mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
controller return json to vue via twig, corrections
This commit is contained in:
parent
65ac9a47b4
commit
9ec2a62fb6
@ -209,14 +209,14 @@ class ActivityController extends AbstractController
|
|||||||
throw $this->createNotFoundException('Template not found');
|
throw $this->createNotFoundException('Template not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$activity_json = $this->serializer->serialize($entity, 'json', ['groups' => 'read']);
|
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
return $this->render($view, [
|
return $this->render($view, [
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'activity_json' => $activity_json
|
'activity_json' => $activity_array
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ class ActivityController extends AbstractController
|
|||||||
throw $this->createNotFoundException('Template not found');
|
throw $this->createNotFoundException('Template not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$activity_json = $this->serializer->serialize($entity, 'json', ['groups' => ['read']]);
|
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
return $this->render($view, array(
|
return $this->render($view, array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
@ -331,7 +331,7 @@ class ActivityController extends AbstractController
|
|||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'activity_json' => $activity_json
|
'activity_json' => $activity_array
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ use Chill\MainBundle\Entity\HasScopeInterface;
|
|||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Activity
|
* Class Activity
|
||||||
@ -61,6 +62,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?int $id;
|
private ?int $id;
|
||||||
|
|
||||||
@ -121,11 +123,13 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $persons;
|
private Collection $persons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $thirdParties;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
@ -136,6 +140,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $users;
|
private Collection $users;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<script src="{{ asset('build/async_upload.js') }}" type="text/javascript"></script>
|
<script src="{{ asset('build/async_upload.js') }}" type="text/javascript"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
window.activity = {{ activity_json|e('js') }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<script src="{{ asset('build/async_upload.js') }}" type="text/javascript"></script>
|
<script src="{{ asset('build/async_upload.js') }}" type="text/javascript"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
window.activity = {{ activity_json|e('js') }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user