record single task states transition and add them in timeline

This commit is contained in:
2018-05-03 23:38:08 +02:00
parent 57169b3148
commit 86f7188d4a
17 changed files with 645 additions and 7 deletions

View File

@@ -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();