@@ 7-51 (lines=45) @@ | ||
4 | ||
5 | use Aura\Sql\ConnectionLocator; |
|
6 | ||
7 | class MysqlSeriesRepository implements SeriesRepositoryInterface |
|
8 | { |
|
9 | ||
10 | /** @var Aura\Sql\ConnectionLocator */ |
|
11 | protected $connections; |
|
12 | ||
13 | /** |
|
14 | * @param Aura\Sql\ConnectionLocator |
|
15 | */ |
|
16 | public function __construct(ConnectionLocator $connections) |
|
17 | { |
|
18 | $this->connections = $connections; |
|
19 | } |
|
20 | ||
21 | /** |
|
22 | * @param integer $post |
|
23 | * |
|
24 | * @return array|false |
|
25 | */ |
|
26 | public function getSeriesForPost($post) |
|
27 | { |
|
28 | $query = " |
|
29 | SELECT `series`.`title` AS `series_title`, `series`.`description` AS `series_descriptions`, |
|
30 | `post.id` AS `post`, `post`.`title`, `post`.`category`, `post`.`path` |
|
31 | FROM `jpemeric_blog`.`series` |
|
32 | INNER JOIN `jpemeric_blog`.`series_post` ON `series_post`.`series` = `series.`id` |
|
33 | INNER JOIN `jpemeric_blog`.`post` ON `post`.`id` = `series_post`.`post` AND |
|
34 | `post`.`display` = :is_active |
|
35 | WHERE `series`.`id` = ( |
|
36 | SELECT `series` |
|
37 | FROM `jpemeric_blog`.`series_post` |
|
38 | WHERE `post` = :lookup_post |
|
39 | LIMIT 1) |
|
40 | ORDER BY `series_post`.`order`"; |
|
41 | $bindings = [ |
|
42 | 'is_active' => 1, |
|
43 | 'lookup_post' => $post, |
|
44 | ]; |
|
45 | ||
46 | return $this |
|
47 | ->connections |
|
48 | ->getRead() |
|
49 | ->fetchAll($query, $bindings); |
|
50 | } |
|
51 | } |
|
52 |
@@ 7-41 (lines=35) @@ | ||
4 | ||
5 | use Aura\Sql\ConnectionLocator; |
|
6 | ||
7 | class MysqlCompanionRepository implements CompanionRepositoryInterface |
|
8 | { |
|
9 | ||
10 | /** @var Aura\Sql\ConnectionLocator */ |
|
11 | protected $connections; |
|
12 | ||
13 | /** |
|
14 | * @param Aura\Sql\ConnectionLocator $connections |
|
15 | */ |
|
16 | public function __construct(ConnectionLocator $connections) |
|
17 | { |
|
18 | $this->connections = $connections; |
|
19 | } |
|
20 | ||
21 | public function getCompanionList() |
|
22 | { |
|
23 | $query = " |
|
24 | SELECT `companion`.`name`, `companion`.`alias`, COUNT(1) AS `count` |
|
25 | FROM `jpemeric_waterfall`.`companion` |
|
26 | INNER JOIN `jpemeric_waterfall`.`log_companion_map` ON `log_companion_map`.`companion` = `companion`.`id` |
|
27 | INNER JOIN `jpemeric_waterfall`.`log` ON `log`.`id` = `log_companion_map`.`log` AND |
|
28 | `log`.`is_public` = :public |
|
29 | GROUP BY `alias` |
|
30 | ORDER BY `name`"; |
|
31 | ||
32 | $bindings = [ |
|
33 | 'public' => 1, |
|
34 | ]; |
|
35 | ||
36 | return $this |
|
37 | ->connections |
|
38 | ->getRead() |
|
39 | ->fetchAll($query, $bindings); |
|
40 | } |
|
41 | } |
|
42 |
@@ 7-40 (lines=34) @@ | ||
4 | ||
5 | use Aura\Sql\ConnectionLocator; |
|
6 | ||
7 | class MysqlCountyRepository implements CountyRepositoryInterface |
|
8 | { |
|
9 | ||
10 | /** @var Aura\Sql\ConnectionLocator */ |
|
11 | protected $connections; |
|
12 | ||
13 | /** |
|
14 | * @param Aura\Sql\ConnectionLocator $connections |
|
15 | */ |
|
16 | public function __construct(ConnectionLocator $connections) |
|
17 | { |
|
18 | $this->connections = $connections; |
|
19 | } |
|
20 | ||
21 | public function getCountyList() |
|
22 | { |
|
23 | $query = " |
|
24 | SELECT `county`.`name`, `county`.`alias`, COUNT(1) AS `count` |
|
25 | FROM `jpemeric_waterfall`.`county` |
|
26 | INNER JOIN `jpemeric_waterfall`.`waterfall` ON `waterfall`.`county` = `county`.`id` AND |
|
27 | `waterfall`.`is_public` = :public |
|
28 | GROUP BY `alias` |
|
29 | ORDER BY `name`"; |
|
30 | ||
31 | $bindings = [ |
|
32 | 'public' => 1, |
|
33 | ]; |
|
34 | ||
35 | return $this |
|
36 | ->connections |
|
37 | ->getRead() |
|
38 | ->fetchAll($query, $bindings); |
|
39 | } |
|
40 | } |
|
41 |
@@ 7-40 (lines=34) @@ | ||
4 | ||
5 | use Aura\Sql\ConnectionLocator; |
|
6 | ||
7 | class MysqlPeriodRepository implements PeriodRepositoryInterface |
|
8 | { |
|
9 | ||
10 | /** @var Aura\Sql\ConnectionLocator */ |
|
11 | protected $connections; |
|
12 | ||
13 | /** |
|
14 | * @param Aura\Sql\ConnectionLocator $connections |
|
15 | */ |
|
16 | public function __construct(ConnectionLocator $connections) |
|
17 | { |
|
18 | $this->connections = $connections; |
|
19 | } |
|
20 | ||
21 | public function getPeriodList() |
|
22 | { |
|
23 | $query = " |
|
24 | SELECT `period`.`name`, `period`.`alias`, COUNT(1) AS `count` |
|
25 | FROM `jpemeric_waterfall`.`period` |
|
26 | INNER JOIN `jpemeric_waterfall`.`log` ON `log`.`period` = `log`.`id` AND |
|
27 | `log`.`is_public` = :public |
|
28 | GROUP BY `alias` |
|
29 | ORDER BY `name`"; |
|
30 | ||
31 | $bindings = [ |
|
32 | 'public' => 1, |
|
33 | ]; |
|
34 | ||
35 | return $this |
|
36 | ->connections |
|
37 | ->getRead() |
|
38 | ->fetchAll($query, $bindings); |
|
39 | } |
|
40 | } |
|
41 |