Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7099 Rev 7109
Línea 90... Línea 90...
90
    {
90
    {
91
        $hydrator = new ObjectPropertyHydrator();
91
        $hydrator = new ObjectPropertyHydrator();
92
        $values = $hydrator->extract($position);
92
        $values = $hydrator->extract($position);
93
        $values = $this->removeEmpty($values);
93
        $values = $this->removeEmpty($values);
Línea -... Línea 94...
-
 
94
        
-
 
95
        $values['boss_id'] = empty($values['boss_id']) ? null : $values['boss_id'];
94
        
96
 
95
        $insert = $this->sql->insert(self::_TABLE);
97
        $insert = $this->sql->insert(self::_TABLE);
96
        $insert->values($values);
98
        $insert->values($values);
97
        
-
 
98
        //echo $insert->getSqlString($this->adapter->platform); exit;
-
 
99
        
-
 
100
        
99
 
101
        $result = $this->executeInsert($insert);
100
        $result = $this->executeInsert($insert);
102
        if($result) {
101
        if($result) {
103
            $position->id = $this->getLastInsertId();
102
            $position->id = $this->getLastInsertId();
104
        }
103
        }
Línea 115... Línea 114...
115
    {
114
    {
116
        $hydrator = new ObjectPropertyHydrator();
115
        $hydrator = new ObjectPropertyHydrator();
117
        $values = $hydrator->extract($position);
116
        $values = $hydrator->extract($position);
118
        $values = $this->removeEmpty($values);
117
        $values = $this->removeEmpty($values);
Línea -... Línea 118...
-
 
118
        
-
 
119
        $values['boss_id'] = empty($values['boss_id']) ? null : $values['boss_id'];
119
        
120
        
120
        $update = $this->sql->update(self::_TABLE);
121
        $update = $this->sql->update(self::_TABLE);
121
        $update->set($values);
122
        $update->set($values);
Línea 122... Línea 123...
122
        $update->where->equalTo('id', $position->id);
123
        $update->where->equalTo('id', $position->id);
Línea 182... Línea 183...
182
    }
183
    }
Línea 183... Línea 184...
183
    
184
    
184
 
185
 
185
    /**
-
 
186
     * 
186
    /**
-
 
187
     * 
187
     * @param int $job_description_id
188
     * @param int $company_id
188
     * @param int $company_id
189
     * @param int $job_description_id
189
     * @return OrganizationPosition[]
190
     * @return OrganizationPosition[]
190
     */
191
     */
191
    public function fetchAllByCompanyIdAndJobDescriptionId($job_description_id, $company_id)
192
    public function fetchAllByCompanyIdAndJobDescriptionId($company_id, $job_description_id )
Línea 192... Línea 193...
192
    {
193
    {
-
 
194
        $prototype = new OrganizationPosition();
193
        $prototype = new OrganizationPosition();
195
        
-
 
196
        $select = $this->sql->select(self::_TABLE);
-
 
197
        $select->where->equalTo('company_id', $company_id);
-
 
198
        $select->where->equalTo('job_description_id', $job_description_id);
-
 
199
         
-
 
200
        return $this->executeFetchAllObject($select, $prototype);
-
 
201
    }
-
 
202
    
-
 
203
    
-
 
204
    
-
 
205
    /**
-
 
206
     *
-
 
207
     * @param int $company_id
-
 
208
     * @param int $boss_id
-
 
209
     * @return OrganizationPosition[]
-
 
210
     */
-
 
211
    public function fetchAllByCompanyIdAndBossId($company_id, $boss_id)
-
 
212
    {
194
        
213
        $prototype = new OrganizationPosition();
195
        $select = $this->sql->select();
214
        
-
 
215
        $select = $this->sql->select(self::_TABLE);
-
 
216
        $select->where->equalTo('company_id', $company_id);
-
 
217
 
-
 
218
        if($boss_id) {
-
 
219
            $select->where->equalTo('boss_id', $boss_id);
-
 
220
        } else {
-
 
221
            $select->where->isNull('boss_id');
-
 
222
        }
-
 
223
        
196
        $select->where->equalTo('job_description_id', $job_description_id);
224
       // echo $select->getSqlString($this->adapter->platform); exit;
197
        $select->where->equalTo('company_id', $company_id);
225
 
Línea -... Línea 226...
-
 
226
        
-
 
227
        return $this->executeFetchAllObject($select, $prototype);
-
 
228
    }
-
 
229
    
-
 
230
    
-
 
231
    /**
-
 
232
     *
-
 
233
     * @param int $employee_id
-
 
234
     * @return boolean
-
 
235
     */
-
 
236
    public function removeParentByEmployeeId($employee_id)
-
 
237
    {
-
 
238
        $values = [
-
 
239
            'boss_id' => null,
-
 
240
        ];
-
 
241
        
-
 
242
        $update = $this->sql->update(self::_TABLE);
-
 
243
        $update->set($values);
-
 
244
        $update->where->equalTo('boss_id', $employee_id);
-
 
245
        
Línea 198... Línea 246...
198
       
246
        //error_log($update->getSqlString($this->adapter->platform));
199
        return $this->executeFetchAllObject($select, $prototype);
247