Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 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\Application;
10
 
11
 
12
class ApplicationMapper extends MapperCommon
13
{
14
    const _TABLE = 'tbl_applications';
15
 
16
    /**
17
     *
18
     * @var ApplicationMapper
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 ApplicationMapper
35
     */
36
    public static function getInstance($adapter)
37
    {
38
        if(self::$_instance == null) {
39
            self::$_instance = new ApplicationMapper($adapter);
40
        }
41
        return self::$_instance;
42
    }
43
 
44
    /**
45
     *
46
     * @param int $id
47
     * @return Application
48
     */
49
    public function fetchOne($id)
50
    {
5050 efrain 51
        $prototype = new Application();
1 www 52
 
5050 efrain 53
 
1 www 54
        $select = $this->sql->select(self::_TABLE);
55
        $select->where->equalTo('id', $id);
56
 
57
        $prototype = new Application();
58
        return $this->executeFetchOneObject($select, $prototype);
59
    }
60
 
61
 
5050 efrain 62
 
63
 
64
 
1 www 65
    /**
66
     *
67
     * @return Application[]
68
     */
69
    public function fetchAll()
70
    {
71
 
72
        $select = $this->sql->select(self::_TABLE);
73
 
74
        $prototype = new Application();
75
        return $this->executeFetchAllObject($select, $prototype);
76
    }
77
 
78
}