Example #1
0
 /**
  * Set values to the query.
  * The method can execute multiple times. The passed array require the
  * same amount of elements, otherwise an exception will thrown.
  *
  * @param array $values An usual array with the values that should insert.
  *
  * @return $this The same instance to concatenate methods.
  */
 public function values(array $values)
 {
     $valuesArray = array();
     foreach ($values as $value) {
         $valuesArray[] = $this->factory->references('Value', $value);
     }
     $this->insert->values($valuesArray);
     return $this;
 }
Example #2
0
 /**
  * Create table objects from the passed arguments.
  * An array will return with the key 'table' for the main table and 'optionalTables' for optional tables.
  * When no optional tables are passed, the key 'optionalTables' return an empty array.
  *
  * @param string $table          Name of the main table.
  * @param array  $optionalTables Optional table names, hold in an array.
  *
  * @return array Array with prepared table objects, format: ['table' => $tbl, 'optionalTables' => array].
  */
 private function _getPreparedTableObjects($table, array $optionalTables)
 {
     $tableObj = $this->factory->references('Table', $table);
     $optionalTablesObj = array();
     foreach ($optionalTables as $tbl) {
         $optionalTablesObj[] = $this->factory->references('Table', $tbl);
     }
     return array('table' => $tableObj, 'optionalTables' => $optionalTablesObj);
 }
Example #3
0
 /**
  * Build objects from the passed arguments.
  * The values will returned as assoc array in the following form:
  * array('column' => $column, 'compareValue' = $value).
  * $column is of type References\Column. When the type argument is equal to 'column',
  * $value is also of type References\Column, otherwise of References\Value.
  * The
  *
  * @param string $column       Name of the column for the comparison.
  * @param string $compareValue Compare value.
  * @param string $type         Type of the compare value, whether column or usual value.
  *
  * @return array Array with prepared objects.
  */
 private function _getPrepareObjectsArray($column, $compareValue, $type)
 {
     $columnObj = $this->factory->references('Column', $column);
     if ($type === 'column') {
         $compareObj = $this->factory->references('Column', $compareValue);
     } else {
         $compareObj = $this->factory->references('Value', $compareValue);
     }
     return array('column' => $columnObj, 'compareValue' => $compareObj);
 }
Example #4
0
 /**
  * Return an condition facade to create where conditions for the query.
  *
  * @return ConditionFacade Instance of conditionFacade.
  */
 public function condition()
 {
     $condition = $this->factory->expression('Condition');
     return $this->factory->expressionFacade('Condition', $condition);
 }