You are here

interface ObjectManager in Plug 7

Contract for a Doctrine persistence layer ObjectManager class to implement.

@link www.doctrine-project.org @since 2.1 @author Benjamin Eberlei <kontakt@beberlei.de> @author Jonathan Wage <jonwage@gmail.com>

Hierarchy

Expanded class hierarchy of ObjectManager

All classes that implement ObjectManager

6 files declare their use of ObjectManager
LifecycleEventArgs.php in lib/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php
LoadClassMetadataEventArgs.php in lib/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php
ManagerEventArgs.php in lib/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php
ObjectManagerDecoratorTest.php in lib/doctrine/common/tests/Doctrine/Tests/Common/Persistence/ObjectManagerDecoratorTest.php
OnClearEventArgs.php in lib/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php

... See full list

File

lib/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php, line 30

Namespace

Doctrine\Common\Persistence
View source
interface ObjectManager {

  /**
   * Finds an object by its identifier.
   *
   * This is just a convenient shortcut for getRepository($className)->find($id).
   *
   * @param string $className The class name of the object to find.
   * @param mixed  $id        The identity of the object to find.
   *
   * @return object The found object.
   */
  public function find($className, $id);

  /**
   * Tells the ObjectManager to make an instance managed and persistent.
   *
   * The object will be entered into the database as a result of the flush operation.
   *
   * NOTE: The persist operation always considers objects that are not yet known to
   * this ObjectManager as NEW. Do not pass detached objects to the persist operation.
   *
   * @param object $object The instance to make managed and persistent.
   *
   * @return void
   */
  public function persist($object);

  /**
   * Removes an object instance.
   *
   * A removed object will be removed from the database as a result of the flush operation.
   *
   * @param object $object The object instance to remove.
   *
   * @return void
   */
  public function remove($object);

  /**
   * Merges the state of a detached object into the persistence context
   * of this ObjectManager and returns the managed copy of the object.
   * The object passed to merge will not become associated/managed with this ObjectManager.
   *
   * @param object $object
   *
   * @return object
   */
  public function merge($object);

  /**
   * Clears the ObjectManager. All objects that are currently managed
   * by this ObjectManager become detached.
   *
   * @param string|null $objectName if given, only objects of this type will get detached.
   *
   * @return void
   */
  public function clear($objectName = null);

  /**
   * Detaches an object from the ObjectManager, causing a managed object to
   * become detached. Unflushed changes made to the object if any
   * (including removal of the object), will not be synchronized to the database.
   * Objects which previously referenced the detached object will continue to
   * reference it.
   *
   * @param object $object The object to detach.
   *
   * @return void
   */
  public function detach($object);

  /**
   * Refreshes the persistent state of an object from the database,
   * overriding any local changes that have not yet been persisted.
   *
   * @param object $object The object to refresh.
   *
   * @return void
   */
  public function refresh($object);

  /**
   * Flushes all changes to objects that have been queued up to now to the database.
   * This effectively synchronizes the in-memory state of managed objects with the
   * database.
   *
   * @return void
   */
  public function flush();

  /**
   * Gets the repository for a class.
   *
   * @param string $className
   *
   * @return \Doctrine\Common\Persistence\ObjectRepository
   */
  public function getRepository($className);

  /**
   * Returns the ClassMetadata descriptor for a class.
   *
   * The class name must be the fully-qualified class name without a leading backslash
   * (as it is returned by get_class($obj)).
   *
   * @param string $className
   *
   * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata
   */
  public function getClassMetadata($className);

  /**
   * Gets the metadata factory used to gather the metadata of classes.
   *
   * @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
   */
  public function getMetadataFactory();

  /**
   * Helper method to initialize a lazy loading proxy or persistent collection.
   *
   * This method is a no-op for other objects.
   *
   * @param object $obj
   *
   * @return void
   */
  public function initializeObject($obj);

  /**
   * Checks if the object is part of the current UnitOfWork and therefore managed.
   *
   * @param object $object
   *
   * @return bool
   */
  public function contains($object);

}

Members

Namesort descending Modifiers Type Description Overrides
ObjectManager::clear public function Clears the ObjectManager. All objects that are currently managed by this ObjectManager become detached. 1
ObjectManager::contains public function Checks if the object is part of the current UnitOfWork and therefore managed. 1
ObjectManager::detach public function Detaches an object from the ObjectManager, causing a managed object to become detached. Unflushed changes made to the object if any (including removal of the object), will not be synchronized to the database. Objects which previously referenced the… 1
ObjectManager::find public function Finds an object by its identifier. 1
ObjectManager::flush public function Flushes all changes to objects that have been queued up to now to the database. This effectively synchronizes the in-memory state of managed objects with the database. 1
ObjectManager::getClassMetadata public function Returns the ClassMetadata descriptor for a class. 1
ObjectManager::getMetadataFactory public function Gets the metadata factory used to gather the metadata of classes. 1
ObjectManager::getRepository public function Gets the repository for a class. 1
ObjectManager::initializeObject public function Helper method to initialize a lazy loading proxy or persistent collection. 1
ObjectManager::merge public function Merges the state of a detached object into the persistence context of this ObjectManager and returns the managed copy of the object. The object passed to merge will not become associated/managed with this ObjectManager. 1
ObjectManager::persist public function Tells the ObjectManager to make an instance managed and persistent. 1
ObjectManager::refresh public function Refreshes the persistent state of an object from the database, overriding any local changes that have not yet been persisted. 1
ObjectManager::remove public function Removes an object instance. 1