|
|
@@ -20,6 +20,7 @@ use Cake\ORM\Query;
|
|
|
use Cake\ORM\Table;
|
|
|
use Cake\ORM\TableRegistry;
|
|
|
use Cake\Utility\Inflector;
|
|
|
+use InvalidArgumentException;
|
|
|
use RuntimeException;
|
|
|
|
|
|
/**
|
|
|
@@ -394,7 +395,7 @@ class BelongsToMany extends Association
|
|
|
}
|
|
|
if (!in_array($strategy, [self::SAVE_APPEND, self::SAVE_REPLACE])) {
|
|
|
$msg = sprintf('Invalid save strategy "%s"', $strategy);
|
|
|
- throw new \InvalidArgumentException($msg);
|
|
|
+ throw new InvalidArgumentException($msg);
|
|
|
}
|
|
|
return $this->_saveStrategy = $strategy;
|
|
|
}
|
|
|
@@ -473,7 +474,7 @@ class BelongsToMany extends Association
|
|
|
if (!(is_array($entities) || $entities instanceof \Traversable)) {
|
|
|
$name = $this->property();
|
|
|
$message = sprintf('Could not save %s, it cannot be traversed', $name);
|
|
|
- throw new \InvalidArgumentException($message);
|
|
|
+ throw new InvalidArgumentException($message);
|
|
|
}
|
|
|
|
|
|
$table = $this->target();
|
|
|
@@ -722,7 +723,7 @@ class BelongsToMany extends Association
|
|
|
|
|
|
if (count(array_filter($primaryValue, 'strlen')) !== count($primaryKey)) {
|
|
|
$message = 'Could not find primary key value for source entity';
|
|
|
- throw new \InvalidArgumentException($message);
|
|
|
+ throw new InvalidArgumentException($message);
|
|
|
}
|
|
|
|
|
|
return $this->junction()->connection()->transactional(
|
|
|
@@ -835,13 +836,13 @@ class BelongsToMany extends Association
|
|
|
{
|
|
|
if ($sourceEntity->isNew()) {
|
|
|
$error = 'Source entity needs to be persisted before proceeding';
|
|
|
- throw new \InvalidArgumentException($error);
|
|
|
+ throw new InvalidArgumentException($error);
|
|
|
}
|
|
|
|
|
|
foreach ($targetEntities as $entity) {
|
|
|
if ($entity->isNew()) {
|
|
|
$error = 'Cannot link not persisted entities';
|
|
|
- throw new \InvalidArgumentException($error);
|
|
|
+ throw new InvalidArgumentException($error);
|
|
|
}
|
|
|
}
|
|
|
|