mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
record single task states transition and add them in timeline
This commit is contained in:
@@ -20,6 +20,8 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\PersonBundle\Entity\PersonRepository;
|
||||
use Chill\MainBundle\Entity\UserRepository;
|
||||
use Chill\TaskBundle\Event\TaskEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class SingleTaskController extends Controller
|
||||
{
|
||||
@@ -30,8 +32,10 @@ class SingleTaskController extends Controller
|
||||
* name="chill_task_single_task_new"
|
||||
* )
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
public function newAction(
|
||||
Request $request,
|
||||
EventDispatcherInterface $dispatcher
|
||||
) {
|
||||
|
||||
$task = (new SingleTask())
|
||||
->setAssignee($this->getUser())
|
||||
@@ -67,6 +71,8 @@ class SingleTaskController extends Controller
|
||||
if ($form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($task);
|
||||
|
||||
$dispatcher->dispatch(TaskEvent::PERSIST, new TaskEvent($task));
|
||||
|
||||
$em->flush();
|
||||
|
||||
|
Reference in New Issue
Block a user