Skip to content
Permalink
Browse files

Optimization.

  • Loading branch information...
robertpustulka committed Feb 3, 2017
1 parent 58c8b6a commit 7cf44a0496b6e166a3a44aa091c2e50bb2c96ec0
Showing with 12 additions and 9 deletions.
  1. +12 −9 src/ORM/Association.php
@@ -397,20 +397,23 @@ public function getTarget()
$tableLocator = $this->tableLocator();
$config = [];
if (!$tableLocator->exists($registryAlias)) {
$exists = $tableLocator->exists($registryAlias);
if (!$exists) {
$config = ['className' => $this->_className];
}
$this->_targetTable = $tableLocator->get($registryAlias, $config);
$targetClassName = get_class($this->_targetTable);
$className = $this->_getClassName($registryAlias, ['className' => $this->_className]);
if ($exists) {
$targetClassName = get_class($this->_targetTable);
$className = $this->_getClassName($registryAlias, ['className' => $this->_className]);
if ($targetClassName !== $className) {
throw new RuntimeException(sprintf(
'Invalid Table retrieved from a registry. Requested: %s, got: %s',
$className,
$targetClassName
));
if ($targetClassName !== $className) {
throw new RuntimeException(sprintf(
'Invalid Table retrieved from a registry. Requested: %s, got: %s',
$className,
$targetClassName
));
}
}
}

0 comments on commit 7cf44a0

Please sign in to comment.
You can’t perform that action at this time.