|
@@ 275-277 (lines=3) @@
|
| 272 |
|
*/ |
| 273 |
|
public function create(array $data = []) |
| 274 |
|
{ |
| 275 |
|
if (isset($data['id']) && isset($this->cache[$data['id']]) && is_object($this->cache[$data['id']])) { |
| 276 |
|
return $this->cache[$data['id']]; |
| 277 |
|
} |
| 278 |
|
|
| 279 |
|
$row = clone $this->row; |
| 280 |
|
|
|
@@ 337-339 (lines=3) @@
|
| 334 |
|
public function createFromDatabase(array $data) |
| 335 |
|
{ |
| 336 |
|
//Get from cache |
| 337 |
|
if (isset($this->cache[$data['id']]) && is_object(isset($this->cache[$data['id']]))) { |
| 338 |
|
return $this->cache[$data['id']]; |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
if (!is_array($row = $this->dataFromDatabase(array_intersect_key($data, $this->fields)))) { |
| 342 |
|
throw new SimpleCrudException('Data not valid'); |