cphalcon
cphalcon copied to clipboard
[BUG]: Model add and next remove related
Describe the bug If exitsts entity A and has many entities B
class A extends Model
{
public function initialize()
{
$this->hasMany(
'id',
B::class,
'a_id',
'manyB'
);
}
}
class B extends Model
{
// ...
}
and is such code:
$a = \A::findFirst();
$b = new \B();
$a->manyB = [$b];
// now should be like at the beginning
// but is not
// because $dirtyRelated is not empty
$a->manyB = [];
$result = $a->save();
// FALSE because try save related $b
var_dump($result);
Expected behavior In above case $result should be TRUE
Details
- Phalcon version: 4.0.0 (4.0.3)
- PHP Version: 7.2
- Operating System: Debian (docker)
- Installation type: Compiling from source
- Server: Nginx
- Other related info (Database, table schema): MySQL 5.5
Fixed in #15165