php - Unexpected Updates in Model Relationships for Phalcon v5.0.0RC3
one text
I'm looking to upgrade from Phalcon v3.4.5 and PHP7.3 to Phalcon v5 and PHP8.1.
I'm testing with Phalcon v5 RC3 and PHP 8.1.
I have
class Hardware
{
public function initialize()
{
$this->hasOne("products_id", "Products", "id", ['alias' => 'products']);
}
}
in the model initialize()
method.
$hardware = \Hardware::findFirstById($id);
$hardware->products_id = null;
if (!$hardware->save()) {
throw new \Exception('Hardware save failed.');
}
When I update products_id column to null with save()
, id column is updated to null as well.
This did not happen in v3.4.5, why does it happen in v5 RC3?
Source