Bluz\Crud\Table::updateOne PHP Method

updateOne() public method

Update item
public updateOne ( mixed $primary, array $data ) : integer
$primary mixed
$data array
return integer
    public function updateOne($primary, $data)
    {
        $row = $this->getTable()->findRow($primary);
        if (!$row) {
            throw new NotFoundException("Record not found");
        }
        $row->setFromArray($data);
        return $row->save();
    }

Usage Example

示例#1
0
文件: Crud.php 项目: Kit-kat1/bluz
 /**
  * updateOne
  *
  * @param array $data
  * @return integer
  */
 public function updateOne($id, $data)
 {
     $id = (int) $id[0];
     \Application\MusicianType\Table::getInstance()->updateTypes($data['types'], $id);
     if (Session::get('image') != '') {
         $data['image'] = Session::get('image');
     }
     $result = parent::updateOne($id, $data);
     return $result;
 }
All Usage Examples Of Bluz\Crud\Table::updateOne