d5673e5a8750f6316a4c329af3982b1aede761af
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Object / ObjectManagerInterfaceException.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Object;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Interface for the TYPO3 Object Manager
19 */
20 interface ObjectManagerInterfaceException extends \TYPO3\CMS\Core\SingletonInterface
21 {
22 /**
23 * Returns TRUE if an object with the given name is registered
24 *
25 * @param string $objectName Name of the object
26 * @return bool TRUE if the object has been registered, otherwise FALSE
27 */
28 public function isRegistered($objectName);
29
30 /**
31 * Returns a fresh or existing instance of the object specified by $objectName.
32 *
33 * Important:
34 *
35 * If possible, instances of Prototype objects should always be created with the
36 * Object Manager's create() method and Singleton objects should rather be
37 * injected by some type of Dependency Injection.
38 *
39 * @param string $objectName The name of the object to return an instance of
40 * @return object The object instance
41 * @api
42 */
43 public function get($objectName);
44
45 /**
46 * Creates a fresh instance of the object specified by $objectName.
47 *
48 * This factory method can only create objects of the scope prototype.
49 * Singleton objects must be either injected by some type of Dependency Injection or
50 * if that is not possible, be retrieved by the get() method of the
51 * Object Manager
52 *
53 * @param string $objectName The name of the object to create
54 * @return object The new object instance
55 * @throws \TYPO3\CMS\Extbase\Object\Exception\WrongScopeException if the created object is not of scope prototype
56 * @api
57 */
58 public function create($objectName);
59
60 /**
61 * Create an instance of $className without calling its constructor
62 *
63 * @param string $className
64 * @return object
65 * @api
66 */
67 public function getEmptyObject($className);
68 }