mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1097: Doctrine 2 ORM doesn't call constructor on object creation when using single table inheritance with abstract base class. #1372
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 3, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user sebak:
Hello,
I have a single table inheritance setup with an abstract base class and 2 concrete classes, like:
/****
@HasLifecycleCallbacks
/_***_/
abstract class Entry
_/
class News extends Entry{
public function *_construct(){
//do stuff
}
...
}
When I do $em->find('News',$id);
It creates the correct News object, but it hasn't called the constructor (so stuff "//do stuff" hasn't been executed). No problem when manually creating new News() object.
@doctrinebot commented on GitHub (Apr 4, 2011):
Comment created by @beberlei:
Not calling the constructor is done by design, not a bug:
http://www.doctrine-project.org/docs/orm/2.0/en/reference/architecture.html#entities
Use @postLoad to perform operations for entities when they are reconstructed from the database.
@doctrinebot commented on GitHub (Apr 4, 2011):
Issue was closed with resolution "Invalid"