TYPO3 API  SVNRelease
RepositoryInterface.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
00006 *  All rights reserved
00007 *
00008 *  This class is a backport of the corresponding class of FLOW3.
00009 *  All credits go to the v5 team.
00010 *
00011 *  This script is part of the TYPO3 project. The TYPO3 project is
00012 *  free software; you can redistribute it and/or modify
00013 *  it under the terms of the GNU General Public License as published by
00014 *  the Free Software Foundation; either version 2 of the License, or
00015 *  (at your option) any later version.
00016 *
00017 *  The GNU General Public License can be found at
00018 *  http://www.gnu.org/copyleft/gpl.html.
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 
00028 /**
00029  * Contract for a repository
00030  *
00031  * @package Extbase
00032  * @subpackage Persistence
00033  * @version $ID:$
00034  * @api
00035  */
00036 interface Tx_Extbase_Persistence_RepositoryInterface {
00037 
00038     /**
00039      * Adds an object to this repository.
00040      *
00041      * @param object $object The object to add
00042      * @return void
00043      * @api
00044      */
00045     public function add($object);
00046 
00047     /**
00048      * Removes an object from this repository.
00049      *
00050      * @param object $object The object to remove
00051      * @return void
00052      * @api
00053      */
00054     public function remove($object);
00055 
00056     /**
00057      * Replaces an object by another.
00058      *
00059      * @param object $existingObject The existing object
00060      * @param object $newObject The new object
00061      * @return void
00062      * @api
00063      */
00064     public function replace($existingObject, $newObject);
00065 
00066     /**
00067      * Replaces an existing object with the same identifier by the given object
00068      *
00069      * @param object $modifiedObject The modified object
00070      * @api
00071      */
00072     public function update($modifiedObject);
00073 
00074     /**
00075      * Returns all objects of this repository add()ed but not yet persisted to
00076      * the storage layer.
00077      *
00078      * @return array An array of objects
00079      */
00080     public function getAddedObjects();
00081 
00082     /**
00083      * Returns an array with objects remove()d from the repository that
00084      * had been persisted to the storage layer before.
00085      *
00086      * @return array
00087      */
00088     public function getRemovedObjects();
00089 
00090     /**
00091      * Returns all objects of this repository.
00092      *
00093      * @return array An array of objects, empty if no objects found
00094      * @api
00095      */
00096     public function findAll();
00097 
00098     /**
00099      * Returns the total number objects of this repository.
00100      *
00101      * @return integer The object count
00102      * @api
00103      */
00104     public function countAll();
00105 
00106     /**
00107      * Removes all objects of this repository as if remove() was called for
00108      * all of them.
00109      *
00110      * @return void
00111      * @api
00112      */
00113     public function removeAll();
00114 
00115     /**
00116      * Finds an object matching the given identifier.
00117      *
00118      * @param int $uid The identifier of the object to find
00119      * @return object The matching object if found, otherwise NULL
00120      * @api
00121      */
00122     public function findByUid($uid);
00123 
00124     /**
00125      * Sets the property names to order the result by per default.
00126      * Expected like this:
00127      * array(
00128      *  'foo' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
00129      *  'bar' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING
00130      * )
00131      *
00132      * @param array $defaultOrderings The property names to order by
00133      * @return void
00134      * @api
00135      */
00136     public function setDefaultOrderings(array $defaultOrderings);
00137 
00138     /**
00139      * Sets the default query settings to be used in this repository
00140      *
00141      * @param Tx_Extbase_Persistence_QuerySettingsInterface $defaultQuerySettings The query settings to be used by default
00142      * @return void
00143      * @api
00144      */
00145     public function setDefaultQuerySettings(Tx_Extbase_Persistence_QuerySettingsInterface $defaultQuerySettings);
00146 
00147     /**
00148      * Returns a query for objects of this repository
00149      *
00150      * @return Tx_Extbase_Persistence_QueryInterface
00151      * @api
00152      */
00153     public function createQuery();
00154 
00155 }
00156 ?>