@@ 122-139 (lines=18) @@ | ||
119 | * |
|
120 | * @throws RecordNotPersistedException |
|
121 | */ |
|
122 | public function update(LanguageEntity $entity) |
|
123 | { |
|
124 | if ($entity->isNew()) { |
|
125 | throw new RecordNotPersistedException('The entity does not exist.'); |
|
126 | } |
|
127 | ||
128 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
129 | ||
130 | $this->connection->update( |
|
131 | self::TABLE, |
|
132 | $databaseArray, |
|
133 | ['short' => $entity->short] |
|
134 | ); |
|
135 | ||
136 | $entity->short = $this->connection->lastInsertId(); |
|
137 | ||
138 | return $entity; |
|
139 | } |
|
140 | ||
141 | /** |
|
142 | * Removes a language from the database. |
@@ 110-127 (lines=18) @@ | ||
107 | * |
|
108 | * @throws RecordNotPersistedException |
|
109 | */ |
|
110 | public function update(PageEntity $entity) |
|
111 | { |
|
112 | if ($entity->isNew()) { |
|
113 | throw new RecordNotPersistedException('The entity does not exist.'); |
|
114 | } |
|
115 | ||
116 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
117 | ||
118 | $this->connection->update( |
|
119 | self::TABLE, |
|
120 | $databaseArray, |
|
121 | ['id' => $entity->id] |
|
122 | ); |
|
123 | ||
124 | $entity->id = (int) $this->connection->lastInsertId(); |
|
125 | ||
126 | return $entity; |
|
127 | } |
|
128 | ||
129 | /** |
|
130 | * Removes a page from the database. |
@@ 129-146 (lines=18) @@ | ||
126 | * |
|
127 | * @throws RecordNotPersistedException |
|
128 | */ |
|
129 | public function update(UserEntity $entity) |
|
130 | { |
|
131 | if ($entity->isNew()) { |
|
132 | throw new RecordNotPersistedException('The entity does not exist.'); |
|
133 | } |
|
134 | ||
135 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
136 | ||
137 | $this->connection->update( |
|
138 | self::TABLE, |
|
139 | $databaseArray, |
|
140 | ['id' => $entity->id] |
|
141 | ); |
|
142 | ||
143 | $entity->id = (int) $this->connection->lastInsertId(); |
|
144 | ||
145 | return $entity; |
|
146 | } |
|
147 | ||
148 | /** |
|
149 | * Removes a user from the database. |
@@ 77-93 (lines=17) @@ | ||
74 | * |
|
75 | * @throws RecordAlreadyExistsException |
|
76 | */ |
|
77 | public function create(CountryEntity $entity) |
|
78 | { |
|
79 | if (!$entity->isNew()) { |
|
80 | throw new RecordAlreadyExistsException('The entity does already exist.'); |
|
81 | } |
|
82 | ||
83 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
84 | ||
85 | $this->connection->insert( |
|
86 | self::TABLE, |
|
87 | $databaseArray |
|
88 | ); |
|
89 | ||
90 | $entity->short = $this->connection->lastInsertId(); |
|
91 | ||
92 | return $entity; |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * Update a country in the database. |
|
@@ 104-121 (lines=18) @@ | ||
101 | * |
|
102 | * @throws RecordNotPersistedException |
|
103 | */ |
|
104 | public function update(CountryEntity $entity) |
|
105 | { |
|
106 | if ($entity->isNew()) { |
|
107 | throw new RecordNotPersistedException('The entity does not exist.'); |
|
108 | } |
|
109 | ||
110 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
111 | ||
112 | $this->connection->update( |
|
113 | self::TABLE, |
|
114 | $databaseArray, |
|
115 | ['short' => $entity->short] |
|
116 | ); |
|
117 | ||
118 | $entity->short = $this->connection->lastInsertId(); |
|
119 | ||
120 | return $entity; |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * Removes a country from the database. |
@@ 87-103 (lines=17) @@ | ||
84 | * |
|
85 | * @throws RecordAlreadyExistsException |
|
86 | */ |
|
87 | public function create(BlockEntity $entity) |
|
88 | { |
|
89 | if (!$entity->isNew()) { |
|
90 | throw new RecordAlreadyExistsException('The entity does already exist.'); |
|
91 | } |
|
92 | ||
93 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
94 | ||
95 | $this->connection->insert( |
|
96 | self::TABLE, |
|
97 | $databaseArray |
|
98 | ); |
|
99 | ||
100 | $entity->id = (int) $this->connection->lastInsertId(); |
|
101 | ||
102 | return $entity; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * Update a page in the database. |
|
@@ 114-131 (lines=18) @@ | ||
111 | * |
|
112 | * @throws RecordNotPersistedException |
|
113 | */ |
|
114 | public function update(BlockEntity $entity) |
|
115 | { |
|
116 | if ($entity->isNew()) { |
|
117 | throw new RecordNotPersistedException('The entity does not exist.'); |
|
118 | } |
|
119 | ||
120 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
121 | ||
122 | $this->connection->update( |
|
123 | self::TABLE, |
|
124 | $databaseArray, |
|
125 | ['id' => $entity->id] |
|
126 | ); |
|
127 | ||
128 | $entity->id = (int) $this->connection->lastInsertId(); |
|
129 | ||
130 | return $entity; |
|
131 | } |
|
132 | ||
133 | /** |
|
134 | * Removes a page from the database. |
@@ 182-198 (lines=17) @@ | ||
179 | * |
|
180 | * @throws RecordAlreadyExistsException |
|
181 | */ |
|
182 | public function create(FieldNoteEntity $entity) |
|
183 | { |
|
184 | if (!$entity->isNew()) { |
|
185 | throw new RecordAlreadyExistsException('The entity does already exist.'); |
|
186 | } |
|
187 | ||
188 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
189 | ||
190 | $this->connection->insert( |
|
191 | self::TABLE, |
|
192 | $databaseArray |
|
193 | ); |
|
194 | ||
195 | $entity->id = $this->connection->lastInsertId(); |
|
196 | ||
197 | return $entity; |
|
198 | } |
|
199 | ||
200 | /** |
|
201 | * Update a field note in the database. |
@@ 206-223 (lines=18) @@ | ||
203 | * |
|
204 | * @throws RecordNotPersistedException |
|
205 | */ |
|
206 | public function update(GeoCacheEntity $entity) |
|
207 | { |
|
208 | if ($entity->isNew()) { |
|
209 | throw new RecordNotPersistedException('The entity does not exist.'); |
|
210 | } |
|
211 | ||
212 | $databaseArray = $this->getDatabaseArrayFromEntity($entity); |
|
213 | ||
214 | $this->connection->update( |
|
215 | self::TABLE, |
|
216 | $databaseArray, |
|
217 | ['cache_id' => $entity->cacheId] |
|
218 | ); |
|
219 | ||
220 | $entity->cacheId = $this->connection->lastInsertId(); |
|
221 | ||
222 | return $entity; |
|
223 | } |
|
224 | ||
225 | /** |
|
226 | * Removes a GeoCache from the database. |