mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 05:26:13 +00:00
add serializer to activityController
This commit is contained in:
parent
968e6914b2
commit
b89cffce68
@ -36,6 +36,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Form\ActivityType;
|
use Chill\ActivityBundle\Form\ActivityType;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ActivityController
|
* Class ActivityController
|
||||||
@ -49,15 +50,19 @@ class ActivityController extends AbstractController
|
|||||||
protected AuthorizationHelper $authorizationHelper;
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
|
|
||||||
protected LoggerInterface $logger;
|
protected LoggerInterface $logger;
|
||||||
|
|
||||||
|
protected SerializerInterface $serializer;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
LoggerInterface $logger
|
LoggerInterface $logger,
|
||||||
|
SerializerInterface $serializer
|
||||||
) {
|
) {
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
$this->serializer = $serializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,11 +209,25 @@ class ActivityController extends AbstractController
|
|||||||
throw $this->createNotFoundException('Template not found');
|
throw $this->createNotFoundException('Template not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$activity_json = $this->serializer->serialize($entity, 'json', []);
|
||||||
|
// "A circular reference has been detected when serializing the object of class "Chill\PersonBundle\Entity\AccompanyingPeriod" (configured limit: 1)."
|
||||||
|
|
||||||
|
$activity_json = null;
|
||||||
|
// activity_json doit retourner qqch comme :
|
||||||
|
// {
|
||||||
|
// "type": "activity",
|
||||||
|
// "persons": [
|
||||||
|
// { type: person, id: xxx, ...}
|
||||||
|
// { ...}
|
||||||
|
// ], ""
|
||||||
|
// }
|
||||||
|
|
||||||
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
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,6 +340,7 @@ class ActivityController extends AbstractController
|
|||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'activity_json' => null
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,15 +6,27 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include 'ChillActivityBundle:Activity:new.html.twig' %}
|
{% include 'ChillActivityBundle:Activity:new.html.twig' %}
|
||||||
|
{{ dump() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
<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 =
|
||||||
|
{
|
||||||
|
"type": "activity",
|
||||||
|
"persons": [],
|
||||||
|
""
|
||||||
|
};
|
||||||
|
{#
|
||||||
|
{{ activity_json|e('json') }};
|
||||||
|
#}
|
||||||
</script>
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
||||||
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -12,9 +12,12 @@
|
|||||||
<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('json') }};
|
||||||
</script>
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
||||||
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -4,4 +4,5 @@ services:
|
|||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||||
$logger: '@chill.main.logger'
|
$logger: '@chill.main.logger'
|
||||||
|
$serializer: '@Symfony\Component\Serializer\SerializerInterface'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user