| @@ 54-73 (lines=20) @@ | ||
| 51 | * |
|
| 52 | * @return array |
|
| 53 | */ |
|
| 54 | public function findCurrentSteps(EntryInterface $entry) |
|
| 55 | { |
|
| 56 | $dql = " |
|
| 57 | SELECT |
|
| 58 | step |
|
| 59 | FROM {$this->_entityName} step |
|
| 60 | JOIN step.entry entry |
|
| 61 | WHERE |
|
| 62 | entry.id = :entryId |
|
| 63 | AND |
|
| 64 | step.type = :stepType |
|
| 65 | "; |
|
| 66 | ||
| 67 | $query = $this->_em->createQuery($dql); |
|
| 68 | $query->setParameter('entryId', $entry->getId()); |
|
| 69 | $query->setParameter('stepType', StepInterface::CURRENT_STEP); |
|
| 70 | ||
| 71 | /** @var StepInterface[] $steps */ |
|
| 72 | return $query->getResult(); |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Поиск шагов в истории |
|
| @@ 82-102 (lines=21) @@ | ||
| 79 | * |
|
| 80 | * @return array |
|
| 81 | */ |
|
| 82 | public function findHistorySteps(EntryInterface $entry) |
|
| 83 | { |
|
| 84 | $dql = " |
|
| 85 | SELECT |
|
| 86 | step |
|
| 87 | FROM {$this->_entityName} step |
|
| 88 | JOIN step.entry entry |
|
| 89 | WHERE |
|
| 90 | entry.id = :entryId |
|
| 91 | AND |
|
| 92 | step.type = :stepType |
|
| 93 | ORDER BY step.finishDate ASC |
|
| 94 | "; |
|
| 95 | ||
| 96 | $query = $this->_em->createQuery($dql); |
|
| 97 | $query->setParameter('entryId', $entry->getId()); |
|
| 98 | $query->setParameter('stepType', StepInterface::HISTORY_STEP); |
|
| 99 | ||
| 100 | /** @var StepInterface[] $steps */ |
|
| 101 | return $query->getResult(); |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||