In CakePHP 2 we can use aliases in updateAll
method, but in CakePHP 3 (tested 3.4.9) cannot using alias?
$this->_table->updateAll([
$this->_table->getAlias() . '.deleted' => Time::now()
], [
$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey() => $entity->{$this->_table->getPrimaryKey()}
]);
If Your table is products
and alias is Products
it's works, but doesn't work if Your table is cart_products
and alias is CartProducts
The SQL should looks like:
UPDATE cart_products AS CartProducts SET... WHERE CartProducts.id = ...
instead of
UPDATE cart_products SET... WHERE CartProducts.id = ...
BTW: code above is from my behavior.