You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have problem with skipAttributes method, which behaves differently than expected.
We have an entity that has a database view as its source, lets call it ViewProduct, and it inherits from another Product entity that has a database table as its source. The database view entity ViewProduct contains more attributes like a reference to the Company entity and the column map definition is joined from both tables.
If we go through the ViewProduct entity and load the related Company entity via ORM, everything works as it should.
However, if the skipAttributes method is called in the Product entity in the initialize method, then by calling parent::initialize in the ViewProduct entity, this call is triggered even when I load the ViewProduct entity from database and this is where the problem occurs, because the related entity Company is always null.
If the skipAttributes method is not called, then Company entity is fetched as it should. This problem occurs in Phalcon version 5. In Phalcon 3 this works without any problems.
skipAttributes() has such strange behavior.
I find it unpleasant that the relationship between skipAttributes() and getChangedFields() is different depending on whether the instance is a new instance or not.
(See abandoned posts)
It may be that skipAttributes() is not reflected correctly.
We have problem with
skipAttributes
method, which behaves differently than expected.We have an entity that has a database view as its source, lets call it
ViewProduct
, and it inherits from anotherProduct
entity that has a database table as its source. The database view entityViewProduct
contains more attributes like a reference to theCompany
entity and the column map definition is joined from both tables.If we go through the
ViewProduct
entity and load the relatedCompany
entity via ORM, everything works as it should.However, if the
skipAttributes
method is called in theProduct
entity in theinitialize
method, then by callingparent::initialize
in theViewProduct
entity, this call is triggered even when I load theViewProduct
entity from database and this is where the problem occurs, because the related entityCompany
is always null.If the
skipAttributes
method is not called, thenCompany
entity is fetched as it should. This problem occurs in Phalcon version 5. In Phalcon 3 this works without any problems.Steps to reproduce the behavior:
Here is a github link to an example application: https://github.com/slechtic/phalcon5_skip_attributes/tree/main
Details
The text was updated successfully, but these errors were encountered: