[TASK] Improve comment of GeneralUtility::makeInstance() 91/32991/5
authorRoland Waldner <mostwantedtypo3@gmail.com>
Sat, 27 Sep 2014 09:08:54 +0000 (11:08 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 2 Oct 2014 10:09:22 +0000 (12:09 +0200)
A note about the fact, that ObjectManager::get() is injecting
dependencies may be helpful.

Resolves: #61916
Releases: master
Change-Id: I4067036ae5d95877245e150c9f7ca91dea3c954e
Reviewed-on: http://review.typo3.org/32991
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index f980da1..139d7f8 100644 (file)
@@ -4284,6 +4284,12 @@ Connection: close
         * You can also pass arguments for a constructor:
         * \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('myClass', $arg1, $arg2, ..., $argN)
         *
+        * You may want to use \TYPO3\CMS\Extbase\Object\ObjectManager::get() if you
+        * want TYPO3 to take care about injecting dependencies of the class to be
+        * created. Therefore create an instance of ObjectManager via
+        * GeneralUtility::makeInstance() first and call its get() method to get
+        * the instance of a specific class.
+        *
         * @throws \InvalidArgumentException if classname is an empty string
         * @param string $className name of the class to instantiate, must not be empty
         * @return object the created instance