Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4689 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4689 Rev 6388
Línea 5... Línea 5...
5
 
5
 
6
 
6
 
7
use LeadersLinked\Mapper\Common\MapperCommon;
7
use LeadersLinked\Mapper\Common\MapperCommon;
-
 
8
use Laminas\Db\Adapter\AdapterInterface;
-
 
9
use LeadersLinked\Model\MyCoachQuestion;
-
 
10
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
-
 
11
use Laminas\Db\ResultSet\HydratingResultSet;
Línea 8... Línea 12...
8
use Laminas\Db\Adapter\AdapterInterface;
12
use Laminas\Paginator\Adapter\DbSelect;
9
use LeadersLinked\Model\MyCoachQuestion;
13
use Laminas\Paginator\Paginator;
10
 
14
 
Línea 41... Línea 45...
41
        return self::$_instance;
45
        return self::$_instance;
42
    }
46
    }
Línea 43... Línea 47...
43
    
47
    
44
    /**
48
    /**
45
     * 
-
 
46
     * @param int $category_id
49
     * 
47
     * @param int $user_id
50
     * @param int $id
48
     * @return MyCoachQuestion
51
     * @return MyCoachQuestion
49
     */
52
     */
50
    public function fetchOneByCategoryIdAndUserId($category_id, $user_id)
53
    public function fetchOne($id)
Línea 51... Línea 54...
51
    {
54
    {
52
        
-
 
53
        $select = $this->sql->select(self::_TABLE);
55
        
-
 
56
        $select = $this->sql->select(self::_TABLE);
Línea 54... Línea 57...
54
        $select->where->equalTo('category_id', $category_id);
57
        $select->where->equalTo('id', $id);
55
        $select->where->equalTo('user_id', $user_id);
58
 
56
        
59
        
Línea 57... Línea -...
57
        $prototype = new MyCoachQuestion();
-
 
58
        return $this->executeFetchOneObject($select, $prototype);
-
 
59
    }
-
 
60
    
-
 
61
    
60
        $prototype = new MyCoachQuestion();
62
    
61
        return $this->executeFetchOneObject($select, $prototype);
63
    
62
    }
64
    
63
    
65
    
64
    
66
    /**
65
    /**
67
     *
66
     *
Línea 68... Línea 67...
68
     * @param 
67
     * @param int $uuid
69
     * @return MyCoachQuestion[]
68
     * @return MyCoachQuestion
70
     */
69
     */
Línea 71... Línea 70...
71
    public function fetchAllByCategoryId($category_id)
70
    public function fetchOneByUuid($uuid)
72
    {
71
    {
73
        
72
        
Línea 74... Línea 73...
74
        $select = $this->sql->select(self::_TABLE);
73
        $select = $this->sql->select(self::_TABLE);
75
        $select->where->equalTo('category_id', $category_id);
74
        $select->where->equalTo('uuid', $uuid);
76
 
75
        
77
        
-
 
78
        $prototype = new MyCoachQuestion();
76
        
79
        return $this->executeFetchAllObject($select, $prototype);
77
        $prototype = new MyCoachQuestion();
80
    }
78
        return $this->executeFetchOneObject($select, $prototype);
81
    
79
    }
82
    /**
80
    
83
     *
-
 
84
     * @param int $category_id
81
    /**
Línea 85... Línea 82...
85
     * @param int $user_id
82
     *
86
     * @return boolean
83
     * @param  MyCoachQuestion $record
Línea -... Línea 84...
-
 
84
     * @return boolean
-
 
85
     */
-
 
86
    public function delete($record)
-
 
87
    {
-
 
88
        $delete = $this->sql->delete(self::_TABLE);
-
 
89
        $delete->where->equalTo('id', $record->id);
-
 
90
        
-
 
91
        return $this->executeDelete($delete);
-
 
92
    }
-
 
93
    
-
 
94
    
-
 
95
    /**
-
 
96
     *
-
 
97
     * @param MyCoachQuestion $record
-
 
98
     * @return boolean
-
 
99
     */
-
 
100
    public function insert($record)
-
 
101
    {
-
 
102
        $hydrator = new ObjectPropertyHydrator();
-
 
103
        $values = $hydrator->extract($record);
-
 
104
        $values = $this->removeEmpty($values);
-
 
105
        
-
 
106
        $insert = $this->sql->insert(self::_TABLE);
-
 
107
        $insert->values($values);
-
 
108
        
-
 
109
        
-
 
110
        $result = $this->executeInsert($insert);
-
 
111
        if ($result) {
-
 
112
            $record->id = $this->lastInsertId;
-
 
113
        }
-
 
114
        
-
 
115
        return $result;
-
 
116
    }
-
 
117
    
-
 
118
    /**
-
 
119
     *
-
 
120
     * @param MyCoachQuestion $record
-
 
121
     * @return boolean
-
 
122
     */
-
 
123
    public function update($record) 
-
 
124
    {
-
 
125
        $hydrator = new ObjectPropertyHydrator();
87
     */
126
        $values = $hydrator->extract($record);
88
    public function deleteByCategoryIdAndUserId($category_id, $user_id)
127
        $values = $this->removeEmpty($values);