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 ObjectRepository 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 ObjectRepository
|
Chris@0
|
31 {
|
Chris@0
|
32 /**
|
Chris@0
|
33 * Finds an object by its primary key / identifier.
|
Chris@0
|
34 *
|
Chris@0
|
35 * @param mixed $id The identifier.
|
Chris@0
|
36 *
|
Chris@12
|
37 * @return object|null The object.
|
Chris@0
|
38 */
|
Chris@0
|
39 public function find($id);
|
Chris@0
|
40
|
Chris@0
|
41 /**
|
Chris@0
|
42 * Finds all objects in the repository.
|
Chris@0
|
43 *
|
Chris@0
|
44 * @return array The objects.
|
Chris@0
|
45 */
|
Chris@0
|
46 public function findAll();
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Finds objects by a set of criteria.
|
Chris@0
|
50 *
|
Chris@0
|
51 * Optionally sorting and limiting details can be passed. An implementation may throw
|
Chris@0
|
52 * an UnexpectedValueException if certain values of the sorting or limiting details are
|
Chris@0
|
53 * not supported.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @param array $criteria
|
Chris@0
|
56 * @param array|null $orderBy
|
Chris@0
|
57 * @param int|null $limit
|
Chris@0
|
58 * @param int|null $offset
|
Chris@0
|
59 *
|
Chris@0
|
60 * @return array The objects.
|
Chris@0
|
61 *
|
Chris@0
|
62 * @throws \UnexpectedValueException
|
Chris@0
|
63 */
|
Chris@0
|
64 public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null);
|
Chris@0
|
65
|
Chris@0
|
66 /**
|
Chris@0
|
67 * Finds a single object by a set of criteria.
|
Chris@0
|
68 *
|
Chris@0
|
69 * @param array $criteria The criteria.
|
Chris@0
|
70 *
|
Chris@12
|
71 * @return object|null The object.
|
Chris@0
|
72 */
|
Chris@0
|
73 public function findOneBy(array $criteria);
|
Chris@0
|
74
|
Chris@0
|
75 /**
|
Chris@0
|
76 * Returns the class name of the object managed by the repository.
|
Chris@0
|
77 *
|
Chris@0
|
78 * @return string
|
Chris@0
|
79 */
|
Chris@0
|
80 public function getClassName();
|
Chris@0
|
81 }
|