Ejemplo n.º 1
0
 /**
  * @covers ::toArray
  */
 public function testToArrayWithInvalidValue()
 {
     $this->setExpectedException('Crate\\Stdlib\\Exception\\InvalidArgumentException');
     ArrayUtils::toArray('foo');
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function execute($input_parameters = null)
 {
     $input_parameters_array = ArrayUtils::toArray($input_parameters);
     $zero_based = isset($input_parameters_array[0]);
     foreach ($input_parameters_array as $parameter => $value) {
         if (is_int($parameter) && $zero_based) {
             $parameter++;
         }
         $this->bindValue($parameter, $value);
     }
     // parameter binding might be unordered, so sort it before execute
     ksort($this->parameters);
     $result = $this->request->__invoke($this, $this->sql, array_values($this->parameters));
     if (is_array($result)) {
         $this->errorCode = $result['code'];
         $this->errorMessage = $result['message'];
         return false;
     }
     $this->collection = $result;
     return true;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function prepare($statement, $options = null)
 {
     $options = ArrayUtils::toArray($options);
     if (isset($options[PDO::ATTR_CURSOR])) {
         trigger_error(sprintf('%s not supported', __METHOD__), E_USER_WARNING);
         return true;
     }
     return new PDOStatement($this, $this->request, $statement, $options);
 }