Feature #31942

new act like objectmanager->create?

Added by Carsten Bleicker over 3 years ago. Updated over 3 years ago.

Status:Rejected Start date:2011-11-19
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

0%

Category:Object
Target version:-
PHP Version: Complexity:
Has patch:No

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

History

#1 Updated by Karsten Dambekalns over 3 years ago

  • Status changed from New to Rejected
  • Assigned To 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