| @@ 53-61 (lines=9) @@ | ||
| 50 | /** |
|
| 51 | * @return CollectionLoader |
|
| 52 | */ |
|
| 53 | public function published() |
|
| 54 | { |
|
| 55 | $now = new DateTime(); |
|
| 56 | $loader = $this->all(); |
|
| 57 | $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
| 58 | ->addOrder('start_date', 'asc'); |
|
| 59 | ||
| 60 | return $loader; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Fetch upcoming entries based on the lifespan or now. |
|
| @@ 46-54 (lines=9) @@ | ||
| 43 | /** |
|
| 44 | * @return CollectionLoader |
|
| 45 | */ |
|
| 46 | public function published() |
|
| 47 | { |
|
| 48 | $now = new DateTime(); |
|
| 49 | $loader = $this->all(); |
|
| 50 | $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
| 51 | ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '>=' ]); |
|
| 52 | ||
| 53 | return $loader; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return CollectionLoader |
|
| @@ 59-67 (lines=9) @@ | ||
| 56 | /** |
|
| 57 | * @return CollectionLoader |
|
| 58 | */ |
|
| 59 | public function expired() |
|
| 60 | { |
|
| 61 | $now = new DateTime(); |
|
| 62 | $loader = $this->all(); |
|
| 63 | $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
| 64 | ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]); |
|
| 65 | ||
| 66 | return $loader; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Fetch upcoming entries based on the median or now. |
|