Overview
Comment: | AbstractEntity: handle multi-type properties, this is dirty but will work for now |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 7.3 |
Files: | files | file ages | folders |
SHA1: |
db40e63e2c422231b95769814b18150e |
User & Date: | bohwaz on 2021-02-01 03:32:27 |
Other Links: | branch diff | manifest | tags |
Context
2021-02-04
| ||
02:49 | Brindille: fix comments check-in: 1c0b155505 user: bohwaz tags: 7.3 | |
2021-02-01
| ||
03:32 | AbstractEntity: handle multi-type properties, this is dirty but will work for now check-in: db40e63e2c user: bohwaz tags: 7.3 | |
03:31 | Brindille: catch non-existing section early check-in: f3c21baccb user: bohwaz tags: 7.3 | |
Changes
Modified src/lib/KD2/DB/AbstractEntity.php from [5689fe6ef9] to [9724f31ba8].
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | } } public function modifiedProperties($for_database = false): array { return array_intersect_key($this->asArray($for_database), $this->_modified); } public function id(int $id = null): int { if (null !== $id) { $this->id = $id; } | > > > > > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | } } public function modifiedProperties($for_database = false): array { return array_intersect_key($this->asArray($for_database), $this->_modified); } public function isModified(): bool { return count($this->_modified) > 0; } public function id(int $id = null): int { if (null !== $id) { $this->id = $id; } |
︙ | ︙ | |||
342 343 344 345 346 347 348 | */ public function __clone() { $this->id = null; $this->_exists = false; } | | > > > > > > > > > > > > | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | */ public function __clone() { $this->id = null; $this->_exists = false; } protected function _checkType(string $key, $value, string $type): bool { if (false !== strpos($type, '|')) { $types = explode('|', $type); foreach ($types as $type) { if ($this->_checkType($key, $value, $type)) { return true; } } return false; } switch ($type) { case 'date': return is_object($value) && $value instanceof \DateTimeInterface; case 'DateTime': return is_object($value) && $value instanceof \DateTimeInterface; default: return $this->_getType($value) == $type; |
︙ | ︙ |