Skip to content

Commit

Permalink
Add support for disabling of the existing check on save
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther Lalk committed Jan 23, 2015
1 parent 646ea2c commit 558c97e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ORM/Table.php
Expand Up @@ -1268,7 +1268,8 @@ public function save(EntityInterface $entity, $options = [])
$options = new ArrayObject($options + [
'atomic' => true,
'associated' => true,
'checkRules' => true
'checkRules' => true,
'checkExisting' => true
]);

if ($entity->errors()) {
Expand Down Expand Up @@ -1303,7 +1304,7 @@ protected function _processSave($entity, $options)
{
$primaryColumns = (array)$this->primaryKey();

if ($primaryColumns && $entity->isNew() && $entity->has($primaryColumns)) {
if ($options['checkExisting'] && $primaryColumns && $entity->isNew() && $entity->has($primaryColumns)) {
$alias = $this->alias();
$conditions = [];
foreach ($entity->extract($primaryColumns) as $k => $v) {
Expand Down

0 comments on commit 558c97e

Please sign in to comment.