|
@@ 239-241 (lines=3) @@
|
| 236 |
|
*/ |
| 237 |
|
public function create(array $data = []) |
| 238 |
|
{ |
| 239 |
|
if (isset($data['id']) && isset($this->cache[$data['id']]) && is_object($this->cache[$data['id']])) { |
| 240 |
|
return $this->cache[$data['id']]; |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
$row = clone $this->row; |
| 244 |
|
|
|
@@ 301-303 (lines=3) @@
|
| 298 |
|
public function createFromDatabase(array $data) |
| 299 |
|
{ |
| 300 |
|
//Get from cache |
| 301 |
|
if (isset($this->cache[$data['id']]) && is_object(isset($this->cache[$data['id']]))) { |
| 302 |
|
return $this->cache[$data['id']]; |
| 303 |
|
} |
| 304 |
|
|
| 305 |
|
if (!is_array($row = $this->dataFromDatabase(array_intersect_key($data, $this->fields)))) { |
| 306 |
|
throw new SimpleCrudException('Data not valid'); |