mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
closes #5968, refs #5798, reverts [7893], when dependent is true, conditions are not respected on HABTM associations when deleting parent record. [7893] would result in orphaned records. If more fine grained control is needed, create a model for the join table and handle it on an application/applicaiton basis.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7988 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7c87d36d74
commit
c53c28760f
2 changed files with 4 additions and 7 deletions
|
@ -1759,7 +1759,7 @@ class Model extends Overloadable {
|
|||
|
||||
foreach ($this->hasAndBelongsToMany as $assoc => $data) {
|
||||
$records = $this->{$data['with']}->find('all', array(
|
||||
'conditions' => array_merge(array($data['foreignKey'] => $id), (array) $data['conditions']),
|
||||
'conditions' => array_merge(array($this->{$data['with']}->escapeField($data['foreignKey']) => $id)),
|
||||
'fields' => $this->{$data['with']}->primaryKey,
|
||||
'recursive' => -1
|
||||
));
|
||||
|
|
|
@ -6370,10 +6370,7 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertFalse($result);
|
||||
|
||||
$result = $Portfolio->ItemsPortfolio->find('all', array('conditions' => array('ItemsPortfolio.portfolio_id' => 1)));
|
||||
$expected = array(
|
||||
array('ItemsPortfolio' => array('id' => 1, 'item_id' => 1, 'portfolio_id' => 1))
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
function testDeleteArticleBLinks() {
|
||||
|
|
Loading…
Add table
Reference in a new issue