failure() public static method

public static failure ( $msg = null, $extra = [] )
Esempio n. 1
0
 /**
  * Report error 
  *
  * @param string $message Error message.
  * @param array $extra Extra data.
  * @return OperationError
  */
 public function reportError($message, $extra = array())
 {
     return $this->lastResult = Result::failure($message, $extra);
 }
Esempio n. 2
0
 /**
  * Update collection
  *
  * FIXME
  */
 public function update(array $data)
 {
     $schema = $this->getSchema();
     $dsId = $schema->getWriteSourceId();
     $conn = ConnectionManager::getInstance()->getConnection($dsId);
     $driver = $conn->createQueryDriver();
     $query = new UpdateQuery();
     $query->setWhere(clone $this->getCurrentReadQuery()->getWhere());
     $query->update($this->getTable());
     $query->set($data);
     $arguments = new ArgumentArray();
     $sql = $query->toSql($driver, $arguments);
     try {
         $this->handle = $conn->prepareAndExecute($sql, $arguments->toArray());
     } catch (Exception $e) {
         return Result::failure('Collection update failed: ' . $e->getMessage(), array('vars' => $arguments->toArray(), 'sql' => $sql, 'exception' => $e));
     }
     return Result::success('Updated', array('sql' => $sql));
 }