Completed
Pull Request — master (#15)
by Wachter
06:00
created

TaskExecutionRepository::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Task\TaskBundle\DoctrineStorage;
4
5
use Doctrine\Common\Persistence\ObjectManager;
6
use Task\Execution\TaskExecutionInterface;
7
use Task\Storage\TaskExecutionRepositoryInterface;
8
use Task\TaskBundle\Entity\TaskExecutionRepository as ORMTaskExecutionRepository;
9
use Task\TaskInterface;
10
11
class TaskExecutionRepository implements TaskExecutionRepositoryInterface
12
{
13
    /**
14
     * @var ObjectManager
15
     */
16
    private $objectManager;
17
18
    /**
19
     * @var ORMTaskExecutionRepository
20
     */
21
    private $taskExecutionRepository;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function save(TaskExecutionInterface $execution)
27
    {
28
        $this->objectManager->persist($execution);
29
        $this->objectManager->flush();
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function add(TaskExecutionInterface $execution)
36
    {
37
        $this->objectManager->flush();
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function findScheduled()
44
    {
45
        return $this->taskExecutionRepository->findScheduled(new \DateTime);
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function findByStartTime(TaskInterface $task, \DateTime $scheduleTime)
52
    {
53
        return $this->taskExecutionRepository->findByStartTime($task, $scheduleTime);
54
    }
55
}
56