Skip to content

Added find-by-task and remove function #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Entity/TaskExecutionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ public function persist(TaskExecutionInterface $execution)
return $this;
}

/**
* {@inheritdoc}
*/
public function remove(TaskExecutionInterface $execution)
{
$this->_em->remove($execution);

return $this;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -87,6 +97,19 @@ public function findByStartTime(TaskInterface $task, \DateTime $scheduleTime)
}
}

/**
* {@inheritdoc}
*/
public function findByTask(TaskInterface $task)
{
return $this->createQueryBuilder('e')
->innerJoin('e.task', 't')
->where('t.uuid = :uuid')
->setParameter('uuid', $task->getUuid())
->getQuery()
->getResult();
}

/**
* {@inheritdoc}
*/
Expand Down
10 changes: 10 additions & 0 deletions src/Entity/TaskRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public function persist(TaskInterface $task)
return $this;
}

/**
* {@inheritdoc}
*/
public function remove(TaskInterface $task)
{
$this->_em->remove($task);

return $this;
}

/**
* {@inheritdoc}
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/doctrine/TaskExecution.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<field name="status" type="string" length="20"/>

<many-to-one target-entity="Task\TaskBundle\Entity\Task" field="task">
<join-column name="task_id" referenced-column-name="uuid" on-delete="SET NULL"/>
<join-column name="task_id" referenced-column-name="uuid" on-delete="CASCADE"/>
</many-to-one>

</entity>
Expand Down