[DDC-2196] EntityManager can't be extended easily Created: 14/Dec/12 Updated: 16/Dec/12 Resolved: 16/Dec/12 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Matthieu Napoli | Assignee: | Benjamin Eberlei |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Description |
public static function create($conn, Configuration $config, EventManager $eventManager = null) { // ... return new EntityManager($conn, $config, $conn->getEventManager()); } The EntityManager::create method uses new on the EntityManager class instead of static. This makes extending that class not practical because we have to rewrite (duplicate) EntityManager::create. Code could be extendable with: public static function create($conn, Configuration $config, EventManager $eventManager = null) { // ... return new static($conn, $config, $conn->getEventManager()); } |
| Comments |
| Comment by Matthieu Napoli [ 14/Dec/12 ] |
|
Pull request is here: https://github.com/doctrine/doctrine2/pull/535 |
| Comment by Benjamin Eberlei [ 16/Dec/12 ] |
|
Its not desired to override the EntityManager, we are currently building a PR to build a decorator for the EntityManager instead. You can decorate the EntityManager yourself. |
| Comment by Matthieu Napoli [ 16/Dec/12 ] |
|
Benjamin Eberlei Shouldn't it be final then? |