Feature #31942

new act like objectmanager->create?

Added by Carsten Bleicker almost 10 years ago. Updated almost 10 years ago.

Status:
Rejected
Priority:
Should have
Category:
Object
Target version:
-
Start date:
2011-11-19
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

hi folks,
maybe its usefull that new acts like the objectmanager to make it easy to change objects by object.yaml?
for examlpla:
new MyModel();
this could be analyzed by looking for interface implementation for this object.
if it has, take a look in objects. yaml config for this interface config and initialized the defined
class. what do you think?

concret problem for me was, that i had to add a public function to the doctrine query object to get access
to the queryBuilder parameter. i had to add in objects.yaml a new persistencemanager and a new query object.
if i would have the upper functionality the new \TYPO3\FLOW3\Doctrine\PersistenceManager::createQueryForType() knows
about my new Query Object.

kind regards
carsten

#1

Updated by Karsten Dambekalns almost 10 years ago

  • Status changed from New to Rejected
  • Assignee set to Karsten Dambekalns

We cannot change the way PHP works, sorry. new FooBar() will always give you an instance of FooBar, no way around that.

You should use $objectManager->get('FooBar') instead to achieve what you want.

Also available in: Atom PDF