annotate vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2 /*
Chris@0 3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Chris@0 4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Chris@0 5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Chris@0 6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Chris@0 7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Chris@0 8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Chris@0 9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Chris@0 10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Chris@0 11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Chris@0 12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Chris@0 13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Chris@0 14 *
Chris@0 15 * This software consists of voluntary contributions made by many individuals
Chris@0 16 * and is licensed under the MIT license. For more information, see
Chris@0 17 * <http://www.doctrine-project.org>.
Chris@0 18 */
Chris@0 19
Chris@0 20 namespace Doctrine\Common\Persistence;
Chris@0 21
Chris@0 22 /**
Chris@0 23 * Contract for a Doctrine persistence layer ObjectManager class to implement.
Chris@0 24 *
Chris@0 25 * @link www.doctrine-project.org
Chris@0 26 * @since 2.1
Chris@0 27 * @author Benjamin Eberlei <kontakt@beberlei.de>
Chris@0 28 * @author Jonathan Wage <jonwage@gmail.com>
Chris@0 29 */
Chris@0 30 interface ObjectManager
Chris@0 31 {
Chris@0 32 /**
Chris@0 33 * Finds an object by its identifier.
Chris@0 34 *
Chris@0 35 * This is just a convenient shortcut for getRepository($className)->find($id).
Chris@0 36 *
Chris@0 37 * @param string $className The class name of the object to find.
Chris@0 38 * @param mixed $id The identity of the object to find.
Chris@0 39 *
Chris@0 40 * @return object The found object.
Chris@0 41 */
Chris@0 42 public function find($className, $id);
Chris@0 43
Chris@0 44 /**
Chris@0 45 * Tells the ObjectManager to make an instance managed and persistent.
Chris@0 46 *
Chris@0 47 * The object will be entered into the database as a result of the flush operation.
Chris@0 48 *
Chris@0 49 * NOTE: The persist operation always considers objects that are not yet known to
Chris@0 50 * this ObjectManager as NEW. Do not pass detached objects to the persist operation.
Chris@0 51 *
Chris@0 52 * @param object $object The instance to make managed and persistent.
Chris@0 53 *
Chris@0 54 * @return void
Chris@0 55 */
Chris@0 56 public function persist($object);
Chris@0 57
Chris@0 58 /**
Chris@0 59 * Removes an object instance.
Chris@0 60 *
Chris@0 61 * A removed object will be removed from the database as a result of the flush operation.
Chris@0 62 *
Chris@0 63 * @param object $object The object instance to remove.
Chris@0 64 *
Chris@0 65 * @return void
Chris@0 66 */
Chris@0 67 public function remove($object);
Chris@0 68
Chris@0 69 /**
Chris@0 70 * Merges the state of a detached object into the persistence context
Chris@0 71 * of this ObjectManager and returns the managed copy of the object.
Chris@0 72 * The object passed to merge will not become associated/managed with this ObjectManager.
Chris@0 73 *
Chris@0 74 * @param object $object
Chris@0 75 *
Chris@0 76 * @return object
Chris@0 77 */
Chris@0 78 public function merge($object);
Chris@0 79
Chris@0 80 /**
Chris@0 81 * Clears the ObjectManager. All objects that are currently managed
Chris@0 82 * by this ObjectManager become detached.
Chris@0 83 *
Chris@0 84 * @param string|null $objectName if given, only objects of this type will get detached.
Chris@0 85 *
Chris@0 86 * @return void
Chris@0 87 */
Chris@0 88 public function clear($objectName = null);
Chris@0 89
Chris@0 90 /**
Chris@0 91 * Detaches an object from the ObjectManager, causing a managed object to
Chris@0 92 * become detached. Unflushed changes made to the object if any
Chris@0 93 * (including removal of the object), will not be synchronized to the database.
Chris@0 94 * Objects which previously referenced the detached object will continue to
Chris@0 95 * reference it.
Chris@0 96 *
Chris@0 97 * @param object $object The object to detach.
Chris@0 98 *
Chris@0 99 * @return void
Chris@0 100 */
Chris@0 101 public function detach($object);
Chris@0 102
Chris@0 103 /**
Chris@0 104 * Refreshes the persistent state of an object from the database,
Chris@0 105 * overriding any local changes that have not yet been persisted.
Chris@0 106 *
Chris@0 107 * @param object $object The object to refresh.
Chris@0 108 *
Chris@0 109 * @return void
Chris@0 110 */
Chris@0 111 public function refresh($object);
Chris@0 112
Chris@0 113 /**
Chris@0 114 * Flushes all changes to objects that have been queued up to now to the database.
Chris@0 115 * This effectively synchronizes the in-memory state of managed objects with the
Chris@0 116 * database.
Chris@0 117 *
Chris@0 118 * @return void
Chris@0 119 */
Chris@0 120 public function flush();
Chris@0 121
Chris@0 122 /**
Chris@0 123 * Gets the repository for a class.
Chris@0 124 *
Chris@0 125 * @param string $className
Chris@0 126 *
Chris@0 127 * @return \Doctrine\Common\Persistence\ObjectRepository
Chris@0 128 */
Chris@0 129 public function getRepository($className);
Chris@0 130
Chris@0 131 /**
Chris@0 132 * Returns the ClassMetadata descriptor for a class.
Chris@0 133 *
Chris@0 134 * The class name must be the fully-qualified class name without a leading backslash
Chris@0 135 * (as it is returned by get_class($obj)).
Chris@0 136 *
Chris@0 137 * @param string $className
Chris@0 138 *
Chris@0 139 * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata
Chris@0 140 */
Chris@0 141 public function getClassMetadata($className);
Chris@0 142
Chris@0 143 /**
Chris@0 144 * Gets the metadata factory used to gather the metadata of classes.
Chris@0 145 *
Chris@0 146 * @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
Chris@0 147 */
Chris@0 148 public function getMetadataFactory();
Chris@0 149
Chris@0 150 /**
Chris@0 151 * Helper method to initialize a lazy loading proxy or persistent collection.
Chris@0 152 *
Chris@0 153 * This method is a no-op for other objects.
Chris@0 154 *
Chris@0 155 * @param object $obj
Chris@0 156 *
Chris@0 157 * @return void
Chris@0 158 */
Chris@0 159 public function initializeObject($obj);
Chris@0 160
Chris@0 161 /**
Chris@0 162 * Checks if the object is part of the current UnitOfWork and therefore managed.
Chris@0 163 *
Chris@0 164 * @param object $object
Chris@0 165 *
Chris@0 166 * @return bool
Chris@0 167 */
Chris@0 168 public function contains($object);
Chris@0 169 }