|
@@ 345-347 (lines=3) @@
|
| 342 |
|
*/ |
| 343 |
|
public function create(array $data = []) |
| 344 |
|
{ |
| 345 |
|
if (isset($data['id']) && isset($this->cache[$data['id']]) && is_object($this->cache[$data['id']])) { |
| 346 |
|
return $this->cache[$data['id']]; |
| 347 |
|
} |
| 348 |
|
|
| 349 |
|
$row = clone $this->row; |
| 350 |
|
|
|
@@ 407-409 (lines=3) @@
|
| 404 |
|
public function createFromDatabase(array $data) |
| 405 |
|
{ |
| 406 |
|
//Get from cache |
| 407 |
|
if (isset($this->cache[$data['id']]) && is_object(isset($this->cache[$data['id']]))) { |
| 408 |
|
return $this->cache[$data['id']]; |
| 409 |
|
} |
| 410 |
|
|
| 411 |
|
foreach ($this->fields as $name => $field) { |
| 412 |
|
$data[$name] = $field->dataFromDatabase($data[$name]); |