/**
* The FOR UPDATE status
+ *
+ * @var bool
*/
protected $forUpdate = FALSE;
* @param array $options
* Array of query options.
*/
- public function __construct($table, $alias = NULL, Connection $connection, $options = []) {
+ public function __construct($table, $alias, Connection $connection, $options = []) {
$options['return'] = Database::RETURN_STATEMENT;
parent::__construct($connection, $options);
$conjunction = isset($options['conjunction']) ? $options['conjunction'] : 'AND';
* {@inheritdoc}
*/
public function hasAllTags() {
- return !(boolean)array_diff(func_get_args(), array_keys($this->alterTags));
+ return !(boolean) array_diff(func_get_args(), array_keys($this->alterTags));
}
/**
* {@inheritdoc}
*/
public function hasAnyTag() {
- return (boolean)array_intersect(func_get_args(), array_keys($this->alterTags));
+ return (boolean) array_intersect(func_get_args(), array_keys($this->alterTags));
}
/**
}
$query .= implode(', ', $fields);
-
// FROM - We presume all queries have a FROM, as any query that doesn't won't need the query builder anyway.
- $query .= "\nFROM ";
+ $query .= "\nFROM";
foreach ($this->tables as $table) {
$query .= "\n";
if (isset($table['join type'])) {
* {@inheritdoc}
*/
public function __clone() {
+ parent::__clone();
+
// On cloning, also clone the dependent objects. However, we do not
// want to clone the database connection object as that would duplicate the
// connection itself.
foreach ($this->union as $key => $aggregate) {
$this->union[$key]['query'] = clone($aggregate['query']);
}
+ foreach ($this->tables as $alias => $table) {
+ if ($table['table'] instanceof SelectInterface) {
+ $this->tables[$alias]['table'] = clone $table['table'];
+ }
+ }
}
}