Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function update($data)
- {
- if ($data instanceof \Nette\Utils\ArrayHash) {
- $data = iterator_to_array($data);
- }
- if (!is_array($data)) {
- throw new \InvalidArgumentException;
- }
- if (isset($data['id'])) {
- return $this->getTable()->where('id = ?', $data['id'])->update($data) ? $data['id'] : NULL;
- } elseif (count($data) > 0) {
- return $this->insert($data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment