|
@@ 306-308 (lines=3) @@
|
| 303 |
|
*/ |
| 304 |
|
public function create(array $data = []) |
| 305 |
|
{ |
| 306 |
|
if (isset($data['id']) && isset($this->cache[$data['id']]) && is_object($this->cache[$data['id']])) { |
| 307 |
|
return $this->cache[$data['id']]; |
| 308 |
|
} |
| 309 |
|
|
| 310 |
|
$row = clone $this->row; |
| 311 |
|
|
|
@@ 368-370 (lines=3) @@
|
| 365 |
|
public function createFromDatabase(array $data) |
| 366 |
|
{ |
| 367 |
|
//Get from cache |
| 368 |
|
if (isset($this->cache[$data['id']]) && is_object(isset($this->cache[$data['id']]))) { |
| 369 |
|
return $this->cache[$data['id']]; |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
if (!is_array($row = $this->dataFromDatabase(array_intersect_key($data, $this->fields)))) { |
| 373 |
|
throw new SimpleCrudException('Data not valid'); |