Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Invalid
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:HideMac OS X 10.6.4, Built in PHP with extra modules:
zend_extension=xdebug.so
extension=mongo.so
extension=mssql.so
extension=xdiff.so
extension=pcntl.so
extension=imap.so
extension=mcrypt.so
Doctrine Commond/DBAL/ODM from gitShowMac OS X 10.6.4, Built in PHP with extra modules: zend_extension=xdebug.so extension=mongo.so extension=mssql.so extension=xdiff.so extension=pcntl.so extension=imap.so extension=mcrypt.so Doctrine Commond/DBAL/ODM from git
Description
It would be useful to be able to use two classes on one document, in a way that transparently extends the original schema. My use case:
I have a base Application that manages users of the system. A module/plugin to the system wants to extend the User records to include references to one of it's documents:
namespace Application\Model;
class User {
//user properties here
}
...
namespace Organisation\Model;
use Application\Model\User as BaseUser;
class Organisation {
//organisations properties
}
class User extends BaseUser {
/** @ReferenceOne(targetDocument="\Organisation\Model\Organisation") */
protected $organisation
}
It this theoretical scenario, the original \Application\Model\User needs to be used by the base application, but the \Organisation\Model\User can be used by the addon module to transparently add more data to the same user. The base class doesn't need to know it will be used this way.
Current behaviour for the above will ignore the additional properties not available in the parent class, and doesn't throw any exceptions/errors.
Other ways to make it work involve the base class knowing it will be extended via SCI, or using a mappedsuperclass?, which isn't transparent in the base class, it needs to be altered to work with it's children.
We have inheritance options that will allow that. Wouldn't this do the trick?