Rev 195 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
194 | PointedEar | 1 | <?php |
2 | |||
200 | PointedEar | 3 | require_once 'models/Series.php'; |
194 | PointedEar | 4 | |
5 | class SeriesMapper extends \PointedEars\PHPX\Db\Mapper |
||
6 | { |
||
7 | private static $_instance; |
||
8 | |||
9 | protected function __construct () |
||
10 | { |
||
11 | /* singleton */ |
||
12 | } |
||
13 | |||
14 | /** |
||
15 | * @return SeriesMapper |
||
16 | */ |
||
17 | public static function getInstance () |
||
18 | { |
||
19 | if (self::$_instance === null) |
||
20 | { |
||
21 | self::$_instance = new self(); |
||
22 | } |
||
23 | |||
24 | return self::$_instance; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param array $series |
||
29 | */ |
||
30 | public function importAll ($series) |
||
31 | { |
||
32 | foreach ($series as $key => &$data) |
||
33 | { |
||
34 | $data['title'] = $key; |
||
35 | $serie = new Series($data); |
||
36 | // var_dump($data); |
||
37 | var_dump($serie); |
||
38 | // $serie->save(); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param array $series |
||
44 | */ |
||
45 | public function getList ($series) |
||
46 | { |
||
195 | PointedEar | 47 | $series2 = array(); |
194 | PointedEar | 48 | |
49 | foreach ($series as $key => &$data) |
||
50 | { |
||
51 | $data['title'] = $key; |
||
52 | $serie = new Series($data); |
||
53 | $series2[] = $serie; |
||
54 | } |
||
55 | |||
56 | return $series2; |
||
57 | } |
||
58 | } |