mirror of
https://0xacab.org/radar/radar-wp.git
synced 2024-12-24 17:46:27 +01:00
153 lines
4.9 KiB
PHP
153 lines
4.9 KiB
PHP
|
<?php
|
||
|
/*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*
|
||
|
* This software consists of voluntary contributions made by many individuals
|
||
|
* and is licensed under the MIT license. For more information, see
|
||
|
* <http://www.doctrine-project.org>.
|
||
|
*/
|
||
|
|
||
|
namespace Doctrine\Common\Persistence;
|
||
|
|
||
|
/**
|
||
|
* Contract for a Doctrine persistence layer ObjectManager class to implement.
|
||
|
*
|
||
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||
|
* @link www.doctrine-project.org
|
||
|
* @since 2.1
|
||
|
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||
|
* @author Jonathan Wage <jonwage@gmail.com>
|
||
|
*/
|
||
|
interface ObjectManager
|
||
|
{
|
||
|
/**
|
||
|
* Finds a object by its identifier.
|
||
|
*
|
||
|
* This is just a convenient shortcut for getRepository($className)->find($id).
|
||
|
*
|
||
|
* @param string
|
||
|
* @param mixed
|
||
|
* @return object
|
||
|
*/
|
||
|
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.
|
||
|
*/
|
||
|
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.
|
||
|
*/
|
||
|
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
|
||
|
*/
|
||
|
function merge($object);
|
||
|
|
||
|
/**
|
||
|
* Clears the ObjectManager. All objects that are currently managed
|
||
|
* by this ObjectManager become detached.
|
||
|
*
|
||
|
* @param string $objectName if given, only objects of this type will get detached
|
||
|
*/
|
||
|
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.
|
||
|
*/
|
||
|
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.
|
||
|
*/
|
||
|
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.
|
||
|
*/
|
||
|
function flush();
|
||
|
|
||
|
/**
|
||
|
* Gets the repository for a class.
|
||
|
*
|
||
|
* @param string $className
|
||
|
* @return \Doctrine\Common\Persistence\ObjectRepository
|
||
|
*/
|
||
|
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
|
||
|
*/
|
||
|
function getClassMetadata($className);
|
||
|
|
||
|
/**
|
||
|
* Gets the metadata factory used to gather the metadata of classes.
|
||
|
*
|
||
|
* @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
|
||
|
*/
|
||
|
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
|
||
|
*/
|
||
|
function initializeObject($obj);
|
||
|
|
||
|
/**
|
||
|
* Check if the object is part of the current UnitOfWork and therefore
|
||
|
* managed.
|
||
|
*
|
||
|
* @param object $object
|
||
|
* @return bool
|
||
|
*/
|
||
|
function contains($object);
|
||
|
}
|