Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4113 Rev 4131
Línea 4... Línea 4...
4
namespace LeadersLinked\Mapper;
4
namespace LeadersLinked\Mapper;
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;
8
use Laminas\Db\Adapter\AdapterInterface;
Línea 9... Línea 9...
9
use LeadersLinked\Model\CalendarEvent;
9
use LeadersLinked\Model\ZoomMeeting;
10
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
10
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
11
 
11
 
Línea 12... Línea 12...
12
 
12
 
13
class CalendarEventMapper extends MapperCommon
13
class ZoomMeetingMapper extends MapperCommon
14
{
14
{
15
    const _TABLE = 'tbl_applications';
15
    const _TABLE = 'tbl_zoom_meetings';
16
 
16
 
Línea 17... Línea 17...
17
    /**
17
    /**
18
     *
18
     *
Línea 30... Línea 30...
30
    }
30
    }
Línea 31... Línea 31...
31
    
31
    
32
    /**
32
    /**
33
     *
33
     *
34
     * @param AdapterInterface $adapter
34
     * @param AdapterInterface $adapter
35
     * @return CalendarEventMapper
35
     * @return ZoomMeetingMapper
36
     */
36
     */
37
    public static function getInstance($adapter)
37
    public static function getInstance($adapter)
38
    {
38
    {
39
        if(self::$_instance == null) {
39
        if(self::$_instance == null) {
40
            self::$_instance = new CalendarEventMapper($adapter);
40
            self::$_instance = new ZoomMeetingMapper($adapter);
41
        }
41
        }
42
        return self::$_instance;
42
        return self::$_instance;
Línea 43... Línea 43...
43
    }
43
    }
44
    
44
    
45
    /**
45
    /**
46
     * 
46
     * 
47
     * @param int $id
47
     * @param int $id
48
     * @return CalendarEvent
48
     * @return ZoomMeeting
49
     */
49
     */
Línea 50... Línea 50...
50
    public function fetchOne($id)
50
    public function fetchOne($id)
51
    {
51
    {
Línea 52... Línea 52...
52
        
52
        
53
        $select = $this->sql->select(self::_TABLE);
53
        $select = $this->sql->select(self::_TABLE);
54
        $select->where->equalTo('id', $id);
54
        $select->where->equalTo('id', $id);
Línea 55... Línea 55...
55
        
55
        
56
        $prototype = new CalendarEvent();
56
        $prototype = new ZoomMeeting();
57
        return $this->executeFetchOneObject($select, $prototype);
57
        return $this->executeFetchOneObject($select, $prototype);
58
    }
58
    }
59
    
59
    
60
    /**
60
    /**
61
     *
61
     *
Línea 62... Línea 62...
62
     * @param string $uuid
62
     * @param string $uuid
63
     * @return CalendarEvent
63
     * @return ZoomMeeting
Línea 64... Línea 64...
64
     */
64
     */
65
    public function fetchOneByUuid($uuid)
65
    public function fetchOneByUuid($uuid)
66
    {
66
    {
Línea 67... Línea 67...
67
        
67
        
68
        $select = $this->sql->select(self::_TABLE);
68
        $select = $this->sql->select(self::_TABLE);
69
        $select->where->equalTo('uuid', $uuid);
69
        $select->where->equalTo('uuid', $uuid);
70
        
70
        
71
        $prototype = new CalendarEvent();
71
        $prototype = new ZoomMeeting();
72
        return $this->executeFetchOneObject($select, $prototype);
72
        return $this->executeFetchOneObject($select, $prototype);
73
    }
73
    }
74
    
74
    
75
    /**
75
    /**
76
     *
76
     *
Línea 77... Línea 77...
77
     * @param CalendarEvent $calendarEvent
77
     * @param ZoomMeeting $zoomMeeting
78
     * @return boolean
78
     * @return boolean
Línea 79... Línea -...
79
     */
-
 
80
    public function insert($calendarEvent)
79
     */
81
    {
-
 
82
        $hydrator = new ObjectPropertyHydrator();
-
 
83
        $values = $hydrator->extract($calendarEvent);
-
 
84
        $values = $this->removeEmpty($values);
-
 
85
        
-
 
86
        $insert = $this->sql->insert(self::_TABLE);
-
 
87
        $insert->values($values);
80
    public function insert($zoomMeeting)
Línea 88... Línea 81...
88
        
81
    {
89
        
82
        $hydrator = new ObjectPropertyHydrator();
90
        $result = $this->executeInsert($insert);
83
        $values = $hydrator->extract($zoomMeeting);
91
        if($result) {
84
        $values = $this->removeEmpty($values);
92
            $calendarEvent->id = $this->lastInsertId;
85
        
93
        }
86
        $insert = $this->sql->insert(self::_TABLE);
94
        
87
        $insert->values($values);
95
        return $result;
88
        
96
        
89
        return $this->executeInsert($insert);
97
    }
90
    }
Línea 98... Línea 91...
98
    
91
    
99
    /**
92
    /**
100
     *
93
     *
Línea 101... Línea 94...
101
     * @param CalendarEvent $calendarEvent
94
     * @param ZoomMeeting $zoomMeeting
102
     * @return boolean
95
     * @return boolean
Línea 103... Línea 96...
103
     */
96
     */
104
    public function update($calendarEvent)
97
    public function update($zoomMeeting)
105
    {
98
    {
106
        $hydrator = new ObjectPropertyHydrator();
99
        $hydrator = new ObjectPropertyHydrator();
107
        $values = $hydrator->extract($calendarEvent);
100
        $values = $hydrator->extract($zoomMeeting);
108
        $values = $this->removeEmpty($values);
101
        $values = $this->removeEmpty($values);
109
        
102
        
110
        $update = $this->sql->update(self::_TABLE);
103
        $update = $this->sql->update(self::_TABLE);
111
        $update->set($values);
104
        $update->set($values);
Línea 112... Línea 105...
112
        $update->where->equalTo('id', $calendarEvent->id);
105
        $update->where->equalTo('id', $zoomMeeting->id);
Línea 113... Línea 106...
113
        
106
        
114
        return $this->executeUpdate($update);
-
 
115
    }
107
        return $this->executeUpdate($update);
116
    
-
 
117
    /**
-
 
118
     *
-
 
119
     * @param CalendarEvent $calendarEvent
-
 
120
     * @return boolean
-
 
121
     */
-
 
122
    public function delete($calendarEvent)
-
 
123
    {
-
 
124
        $delete = $this->sql->delete(self::_TABLE);
-
 
125
        $delete->where->equalTo('id', $calendarEvent->id);
-
 
126
        
-
 
127
        return $this->executeDelete($delete);
-
 
128
        
-
 
129
        
-
 
130
    }
-
 
131
    
-
 
132
    
-
 
133
    /**
-
 
134
     *
-
 
135
     * @return CalendarEvent[]
-
 
136
     */
-
 
137
    public function fetchAllByUserIdAndYearAndMonth($user_id, $year, $month)
-
 
138
    {
-
 
Línea 139... Línea 108...
139
        
108
    }
140
        $start = mktime(0, 0, 0, $month, 1, $year);
109