Skip to content

[BUG]: using skipAttributes method causes column map load incorrectly in inherited entity #16544

@markofo

Description

@markofo

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.

Steps to reproduce the behavior:
Here is a github link to an example application: https://github.com/slechtic/phalcon5_skip_attributes/tree/main

Details

  • Phalcon version: 5.6.1
  • PHP Version: 8.2.15
  • Operating System: Debian 12
  • Installation type: Compiling from source
  • Zephir version (if any): 0.18.0
  • Server: Apache
  • Other related info: PostgreSQL 14

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: mediumMedium

Type

No fields configured for Bug.

Projects

Status
Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions