diff --git a/src/ORM/Association.php b/src/ORM/Association.php index d330ba6278b..425bef49872 100644 --- a/src/ORM/Association.php +++ b/src/ORM/Association.php @@ -463,6 +463,24 @@ public function transformRow($row, $nestKey, $joined) { return $row; } +/** + * Returns a modified row after appending a property for this association + * with the default empty value according to whether the association was + * joined or fetched externally. + * + * @param array $row + * @param boolean $joined Whether or not the row is a result of a direct join + * with this association + * @return array + */ + public function defaultRowValue($row, $joined) { + $sourceAlias = $this->source()->alias(); + if (isset($row[$sourceAlias])) { + $row[$sourceAlias][$this->property()] = null; + } + return $row; + } + /** * Proxies the finding operation to the target table's find method * and modifies the query accordingly based of this association @@ -685,16 +703,4 @@ public abstract function isOwningSide(Table $side); */ public abstract function save(Entity $entity, $options = []); -/** - * Returns a modified row after appending a property for this association - * with the default empty value according to whether the association was - * joined or fetched externally. - * - * @param array $row - * @param boolean $joined Whether or not the row is a result of a direct join - * with this association - * @return array - */ - abstract public function defaultRowValue($row, $joined); - } diff --git a/src/ORM/Association/BelongsTo.php b/src/ORM/Association/BelongsTo.php index e56c4156307..cd1375a61ff 100644 --- a/src/ORM/Association/BelongsTo.php +++ b/src/ORM/Association/BelongsTo.php @@ -135,18 +135,6 @@ public function save(Entity $entity, $options = []) { return $entity; } -/** - * {@inheritdoc} - * - */ - public function defaultRowValue($row, $joined) { - $sourceAlias = $this->source()->alias(); - if (isset($row[$sourceAlias])) { - $row[$sourceAlias][$this->property()] = null; - } - return $row; - } - /** * Returns a single or multiple conditions to be appended to the generated join * clause for getting the results on the target table. diff --git a/src/ORM/Association/HasOne.php b/src/ORM/Association/HasOne.php index 26ced8d3997..1ad0ea147c5 100644 --- a/src/ORM/Association/HasOne.php +++ b/src/ORM/Association/HasOne.php @@ -130,18 +130,6 @@ public function save(Entity $entity, $options = []) { return $entity; } -/** - * {@inheritdoc} - * - */ - public function defaultRowValue($row, $joined) { - $sourceAlias = $this->source()->alias(); - if (isset($row[$sourceAlias])) { - $row[$sourceAlias][$this->property()] = null; - } - return $row; - } - /** * {@inheritdoc} * diff --git a/tests/TestCase/ORM/AssociationTest.php b/tests/TestCase/ORM/AssociationTest.php index cd1c22e9ce8..b32588b4918 100644 --- a/tests/TestCase/ORM/AssociationTest.php +++ b/tests/TestCase/ORM/AssociationTest.php @@ -52,7 +52,7 @@ public function setUp() { '\Cake\ORM\Association', [ '_options', 'attachTo', '_joinCondition', 'cascadeDelete', 'isOwningSide', - 'save', 'eagerLoader', 'type', 'defaultRowValue' + 'save', 'eagerLoader', 'type' ], ['Foo', $config] );