Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
4458 efrain 1
<?php
2
declare(strict_types=1);
3
 
4
namespace LeadersLinked\Mapper;
5
 
6
 
7
use LeadersLinked\Mapper\Common\MapperCommon;
8
use Laminas\Db\Adapter\AdapterInterface;
9
use LeadersLinked\Model\Theme;
10
 
11
 
12
class ThemeMapper extends MapperCommon
13
{
14
    const _TABLE = 'tbl_themes';
15
 
16
    /**
17
     *
18
     * @var ThemeMapper
19
     */
20
    private static $_instance;
21
 
22
    /**
23
     *
24
     * @param AdapterInterface $adapter
25
     */
26
    private function __construct($adapter)
27
    {
28
        parent::__construct($adapter);
29
    }
30
 
31
    /**
32
     *
33
     * @param AdapterInterface $adapter
34
     * @return ThemeMapper
35
     */
36
    public static function getInstance($adapter)
37
    {
38
        if(self::$_instance == null) {
39
            self::$_instance = new ThemeMapper($adapter);
40
        }
41
        return self::$_instance;
42
    }
43
 
44
    /**
45
     *
46
     * @param int $id
47
     * @return Theme
48
     */
49
    public function fetchOne($id)
50
    {
51
 
52
        $select = $this->sql->select(self::_TABLE);
53
        $select->where->equalTo('id', $id);
54
 
55
        $prototype = new Theme();
56
        return $this->executeFetchOneObject($select, $prototype);
57
    }
58
 
59
 
60
    /**
61
     *
62
     * @param string uuid
63
     * @return Theme
64
     */
65
    public function fetchOneByUuid($uuid)
66
    {
67
 
68
        $select = $this->sql->select(self::_TABLE);
69
        $select->where->equalTo('uuid', $uuid);
70
 
71
        $prototype = new Theme();
72
        return $this->executeFetchOneObject($select, $prototype);
73
    }
74
 
75
    /**
76
     *
77
     * @return Theme[]
78
     */
79
    public function fetchAll()
80
    {
81
 
82
        $select = $this->sql->select(self::_TABLE);
83
 
84
        $prototype = new Theme();
85
        return $this->executeFetchAllObject($select, $prototype);
86
    }
87
 
88
}