Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
PostSummaryCollection | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 1 |
getRevisionClass | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getWorkflowId | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
getBoardWorkflowId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPost | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Flow\Collection; |
4 | |
5 | use Flow\Container; |
6 | use Flow\Model\UUID; |
7 | |
8 | class PostSummaryCollection extends LocalCacheAbstractCollection { |
9 | /** |
10 | * @var UUID |
11 | */ |
12 | protected $rootId; |
13 | |
14 | public static function getRevisionClass() { |
15 | return \Flow\Model\PostSummary::class; |
16 | } |
17 | |
18 | public function getWorkflowId() { |
19 | // the root post (topic title) has the same id as the workflow |
20 | if ( !$this->rootId ) { |
21 | /** @var \Flow\Repository\TreeRepository $treeRepo */ |
22 | $treeRepo = Container::get( 'repository.tree' ); |
23 | $this->rootId = $treeRepo->findRoot( $this->getId() ); |
24 | } |
25 | |
26 | return $this->rootId; |
27 | } |
28 | |
29 | public function getBoardWorkflowId() { |
30 | return $this->getPost()->getBoardWorkflowId(); |
31 | } |
32 | |
33 | /** |
34 | * Get the post collection for this summary |
35 | * @return PostCollection |
36 | */ |
37 | public function getPost() { |
38 | return PostCollection::newFromId( $this->uuid ); |
39 | } |
40 | } |