1 | <?php |
||
17 | abstract class AbstractMongoRepository implements Repository |
||
18 | { |
||
19 | /** |
||
20 | * @var DocumentManager |
||
21 | */ |
||
22 | protected $dm; |
||
23 | /** |
||
24 | * @var DocumentRepository |
||
25 | */ |
||
26 | protected $documentRepository; |
||
27 | |||
28 | public function __construct(DocumentManager $dm = null) |
||
33 | |||
34 | /** |
||
35 | * @return AggregateRoot[] |
||
36 | */ |
||
37 | public function getAll() |
||
41 | |||
42 | /** |
||
43 | * @param Identity $identity |
||
44 | * |
||
45 | * @return AggregateRoot |
||
46 | */ |
||
47 | public function get(Identity $identity) |
||
51 | |||
52 | /** |
||
53 | * @param AggregateRoot $document |
||
54 | */ |
||
55 | public function add(AggregateRoot $document) |
||
59 | |||
60 | /** |
||
61 | * Finds Entities by a set of criteria. |
||
62 | * |
||
63 | * @param array $criteria Query criteria |
||
64 | * @param array $sort Sort array for Cursor::sort() |
||
65 | * @param int|null $limit Limit for Cursor::limit() |
||
66 | * @param int|null $skip Skip for Cursor::skip() |
||
67 | * |
||
68 | * @return AggregateRoot[] |
||
69 | */ |
||
70 | protected function getBy(array $criteria, array $sort = null, $limit = null, $skip = null) |
||
74 | |||
75 | /** |
||
76 | * Finds a single AggregateRoot by a set of criteria. |
||
77 | * |
||
78 | * @param array $criteria |
||
79 | * |
||
80 | * @return AggregateRoot |
||
81 | */ |
||
82 | protected function getOneBy(array $criteria) |
||
86 | |||
87 | /** |
||
88 | * @param Identity $id |
||
89 | * |
||
90 | * @return MongoId |
||
91 | */ |
||
92 | protected function createMongoIdFromIdentity(Identity $id) |
||
96 | } |
||
97 |