Skip to content
Permalink
Browse files

cascade callback bug for aliased associations

  • Loading branch information...
PGBI committed Apr 15, 2015
1 parent 358cad6 commit 5070fc61ae963ee64ae08e7776dd4fbf2f54ed59
Showing with 6 additions and 6 deletions.
  1. +5 −5 src/ORM/Association/BelongsToMany.php
  2. +1 −1 src/ORM/Association/ExternalAssociationTrait.php
@@ -1002,12 +1002,12 @@ protected function _junctionTableName($name = null)
{
if ($name === null) {
if (empty($this->_junctionTableName)) {
$aliases = array_map('\Cake\Utility\Inflector::underscore', [
$this->source()->alias(),
$this->target()->alias()
$tablesNames = array_map('\Cake\Utility\Inflector::underscore', [
$this->source()->table(),
$this->target()->table()
]);
sort($aliases);
$this->_junctionTableName = implode('_', $aliases);
sort($tablesNames);
$this->_junctionTableName = implode('_', $tablesNames);
}
return $this->_junctionTableName;
}
@@ -57,7 +57,7 @@ public function foreignKey($key = null)
{
if ($key === null) {
if ($this->_foreignKey === null) {
$this->_foreignKey = $this->_modelKey($this->source()->alias());
$this->_foreignKey = $this->_modelKey($this->source()->table());
}
return $this->_foreignKey;
}

0 comments on commit 5070fc6

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