Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1527 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1527 Rev 3471
Línea 3... Línea 3...
3
 
3
 
Línea 4... Línea 4...
4
namespace LeadersLinked\Mapper;
4
namespace LeadersLinked\Mapper;
5
 
5
 
6
use LeadersLinked\Mapper\Common\MapperCommon;
-
 
7
use Laminas\Db\Adapter\AdapterInterface;
6
use LeadersLinked\Mapper\Common\MapperCommon;
8
use LeadersLinked\Model\Survey;
-
 
9
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
-
 
10
use Laminas\Paginator\Paginator;
-
 
11
use Laminas\Db\ResultSet\HydratingResultSet;
7
use Laminas\Db\Adapter\AdapterInterface;
Línea 12... Línea 8...
12
use Laminas\Paginator\Adapter\DbSelect;
8
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
13
use LeadersLinked\Model\SurveyJobDescription;
9
use LeadersLinked\Model\SurveyJobDescription;
14
 
10
 
Línea 15... Línea 11...
15
 
11
 
16
class SurveyJobDescriptionMapper extends MapperCommon
12
class SurveyJobDescriptionMapper extends MapperCommon
17
{
13
{
18
    const _TABLE = 'tbl_survey_job_description';
14
    const _TABLE = 'tbl_survey_jobs_description';
Línea 46... Línea 42...
46
    }
42
    }
Línea 47... Línea 43...
47
    
43
    
48
    /**
44
    /**
49
     * 
45
     * 
50
     * @param int $id
46
     * @param int $id
51
     * @return Survey
47
     * @return SurveyJobDescription
52
     */
48
     */
53
    public function fetchOne($id)
49
    public function fetchOne($id)
54
    {
50
    {
Línea 55... Línea 51...
55
        $prototype = new Survey();
51
        $prototype = new SurveyJobDescription();
56
        
52
        
Línea 57... Línea 53...
57
        $select = $this->sql->select(self::_TABLE);
53
        $select = $this->sql->select(self::_TABLE);
Línea 62... Línea 58...
62
    
58
    
63
    
59
    
64
    /**
60
    /**
65
     *
61
     *
66
     * @param int $uuid
62
     * @param int $uuid
67
     * @return Survey
63
     * @return SurveyJobDescription
68
     */
64
     */
69
    public function fetchOneByUuid($uuid)
65
    public function fetchOneByUuid($uuid)
70
    {
66
    {
71
        $prototype = new Survey();
67
        $prototype = new SurveyJobDescription();
Línea 72... Línea 68...
72
        $select = $this->sql->select(self::_TABLE);
68
        $select = $this->sql->select(self::_TABLE);
73
        $select->where->equalTo('uuid', $uuid);
69
        $select->where->equalTo('uuid', $uuid);
Línea 74... Línea 70...
74
        
70
        
75
        return $this->executeFetchOneObject($select, $prototype);
71
        return $this->executeFetchOneObject($select, $prototype);
76
    }
72
    }
77
   
73
   
78
    
74
    
79
    /**
75
    /**
80
     *
76
     *
81
     * @param int $survey_id
77
     * @param int $survey_id
Línea 105... Línea 101...
105
        $values = $this->removeEmpty($values);
101
        $values = $this->removeEmpty($values);
Línea 106... Línea 102...
106
        
102
        
107
        $insert = $this->sql->insert(self::_TABLE);
103
        $insert = $this->sql->insert(self::_TABLE);
Línea 108... Línea -...
108
        $insert->values($values);
-
 
109
        
-
 
110
        //echo $insert->getSqlString($this->adapter->platform); exit;
-
 
Línea 111... Línea 104...
111
        
104
        $insert->values($values);
112
        //echo $insert->getSqlString($this->adapter->platform); exit;
105
        
113
 
106
 
114
        $result = $this->executeInsert($insert);
107
        $result = $this->executeInsert($insert);
115
        if($result) {
108
        if($result) {
116
            $record->id = $this->lastInsertId;
109
            $record->id = $this->lastInsertId;
Línea 117... Línea 110...
117
        }
110
        }
118
        return $result;
111
        return $result;
119
    }
112
    }
120
    
113
    
121
    /**
114
    /**
122
     *
115
     *
123
     * @param SurveyForm $form
116
     * @param SurveyJobDescription $record
124
     * @return boolean
117
     * @return boolean
125
     */
118
     */
126
    public function update($form)
119
    public function update($record)
Línea 127... Línea 120...
127
    {
120
    {
128
        $hydrator = new ObjectPropertyHydrator();
121
        $hydrator = new ObjectPropertyHydrator();
129
        $values = $hydrator->extract($form);
122
        $values = $hydrator->extract($record);
Línea 130... Línea 123...
130
        $values = $this->removeEmpty($values);
123
        $values = $this->removeEmpty($values);
131
        
124
        
Línea 132... Línea 125...
132
        $update = $this->sql->update(self::_TABLE);
125
        $update = $this->sql->update(self::_TABLE);
133
        $update->set($values);
126
        $update->set($values);
134
        $update->where->equalTo('id', $form->id);
127
        $update->where->equalTo('id', $record->id);
135
        
128
        
136
        return $this->executeUpdate($update); 
129
        return $this->executeUpdate($update); 
137
    }
130
    }
138
    
131
    
139
    /**
132
    /**
140
     *
133
     *
Línea 141... Línea 134...
141
     * @param int $form_id
134
     * @param int $survey_id