|
@@ 252-254 (lines=3) @@
|
| 249 |
|
*/ |
| 250 |
|
public function create(array $data = []) |
| 251 |
|
{ |
| 252 |
|
if (isset($data['id']) && isset($this->cache[$data['id']]) && is_object($this->cache[$data['id']])) { |
| 253 |
|
return $this->cache[$data['id']]; |
| 254 |
|
} |
| 255 |
|
|
| 256 |
|
$row = clone $this->row; |
| 257 |
|
|
|
@@ 314-316 (lines=3) @@
|
| 311 |
|
public function createFromDatabase(array $data) |
| 312 |
|
{ |
| 313 |
|
//Get from cache |
| 314 |
|
if (isset($this->cache[$data['id']]) && is_object(isset($this->cache[$data['id']]))) { |
| 315 |
|
return $this->cache[$data['id']]; |
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
if (!is_array($row = $this->dataFromDatabase(array_intersect_key($data, $this->fields)))) { |
| 319 |
|
throw new SimpleCrudException('Data not valid'); |