Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4689 | 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\MyCoachQuestionCategory;
Línea 8... Línea 10...
8
use Laminas\Db\Adapter\AdapterInterface;
10
use LeadersLinked\Model\MyCoachQuestion;
9
use LeadersLinked\Model\MyCoachQuestionCategory;
11
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
10
 
12
 
Línea 92... Línea 94...
92
        $delete->where->equalTo('question_id', $question_id);
94
        $delete->where->equalTo('question_id', $question_id);
Línea 93... Línea 95...
93
        
95
        
94
        return $this->executeDelete($delete);
96
        return $this->executeDelete($delete);
Línea -... Línea 97...
-
 
97
    }
-
 
98
    
-
 
99
    
-
 
100
    /**
-
 
101
     *
-
 
102
     * @param int $question_id
-
 
103
     * @return boolean
-
 
104
     */
-
 
105
    public function deleteAllByQuestionId($question_id )
-
 
106
    {
-
 
107
        $delete = $this->sql->delete(self::_TABLE);
-
 
108
        $delete->where->equalTo('question_id', $question_id);
-
 
109
        
-
 
110
        return $this->executeDelete($delete);
-
 
111
    }
-
 
112
    
-
 
113
    
-
 
114
    /**
-
 
115
     *
-
 
116
     * @param int $id
-
 
117
     * @return boolean
-
 
118
     */
-
 
119
    public function delete($id)
-
 
120
    {
-
 
121
        $delete = $this->sql->delete(self::_TABLE);
-
 
122
        $delete->where->equalTo('id', $id);
-
 
123
        
-
 
124
        return $this->executeDelete($delete);
-
 
125
    }
-
 
126
    
-
 
127
    
-
 
128
    /**
-
 
129
     *
-
 
130
     * @param MyCoachQuestion $record
-
 
131
     * @return boolean
-
 
132
     */
-
 
133
    public function insert($record) {
-
 
134
        $hydrator = new ObjectPropertyHydrator();
-
 
135
        $values = $hydrator->extract($record);
-
 
136
        $values = $this->removeEmpty($values);
-
 
137
        
-
 
138
        $insert = $this->sql->insert(self::_TABLE);
-
 
139
        $insert->values($values);
-
 
140
        
-
 
141
        
-
 
142
        $result = $this->executeInsert($insert);
-
 
143
        if ($result) {
-
 
144
            $record->id = $this->lastInsertId;
-
 
145
        }
-
 
146
        
-
 
147
        return $result;
-
 
148
    }
-
 
149
    
-
 
150
    /**
-
 
151
     *
-
 
152
     * @param MyCoachQuestion $record
-
 
153
     * @return boolean
-
 
154
     */
-
 
155
    public function update($record) {
-
 
156
        $hydrator = new ObjectPropertyHydrator();
-
 
157
        $values = $hydrator->extract($record);
-
 
158
        $values = $this->removeEmpty($values);
-
 
159
        
-
 
160
        $update = $this->sql->update(self::_TABLE);
-
 
161
        $update->set($values);
-
 
162
        $update->where->equalTo('id', $record->id);
-
 
163
        
-
 
164
        return $this->executeUpdate($update);
-
 
165
    }
95
    }
166
    
96
    
167