1 | <?php |
||
15 | class InverseCollection extends ModelCollection |
||
16 | { |
||
17 | /** |
||
18 | * The owning model of the inverse relationship. |
||
19 | * |
||
20 | * @var Model |
||
21 | */ |
||
22 | private $owner; |
||
23 | |||
24 | /** |
||
25 | * The inverse relationship query field. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $inverseField; |
||
30 | |||
31 | /** |
||
32 | * {@inheritDoc} |
||
33 | */ |
||
34 | protected $loaded = false; |
||
35 | |||
36 | /** |
||
37 | * {@inheritDoc} |
||
38 | * @param Model $owner |
||
39 | * @param string $inverseField |
||
40 | */ |
||
41 | public function __construct(EntityMetadata $metadata, Store $store, Model $owner, $inverseField) |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | * |
||
51 | * Overwritten to prevent modification. |
||
52 | * |
||
53 | * @throws \BadMethodCallException |
||
54 | */ |
||
55 | public function clear() |
||
59 | |||
60 | /** |
||
61 | * {@inheritDoc} |
||
62 | * |
||
63 | * Overwritten to ensure the collection is loaded, since references aren't sent to inverse collections. |
||
64 | */ |
||
65 | public function count() |
||
70 | |||
71 | /** |
||
72 | * {@inheritDoc} |
||
73 | * |
||
74 | * Overwritten to ensure the collection is loaded, since references aren't sent to inverse collections. |
||
75 | */ |
||
76 | public function allWithoutLoad() |
||
81 | |||
82 | /** |
||
83 | * {@inheritDoc} |
||
84 | */ |
||
85 | public function getIdentifiers($onlyUnloaded = true) |
||
92 | |||
93 | /** |
||
94 | * Gets the model that owns this inverse collection. |
||
95 | * |
||
96 | * @return Model |
||
97 | */ |
||
98 | public function getOwner() |
||
102 | |||
103 | /** |
||
104 | * {@inheritDoc} |
||
105 | */ |
||
106 | public function getQueryField() |
||
110 | |||
111 | /** |
||
112 | * {@inheritDoc} |
||
113 | * |
||
114 | * Overwritten to ensure the collection is loaded, since references aren't sent to inverse collections. |
||
115 | */ |
||
116 | public function getTotalCount() |
||
120 | |||
121 | /** |
||
122 | * {@inheritDoc} |
||
123 | * |
||
124 | * Overwritten to always return false. |
||
125 | * |
||
126 | */ |
||
127 | public function isDirty() |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | * |
||
135 | * Overwritten to prevent modification. |
||
136 | * |
||
137 | * @throws \BadMethodCallException |
||
138 | */ |
||
139 | public function push(AbstractModel $model) |
||
143 | |||
144 | /** |
||
145 | * {@inheritdoc} |
||
146 | * |
||
147 | * Overwritten to prevent modification. |
||
148 | * |
||
149 | * @throws \BadMethodCallException |
||
150 | */ |
||
151 | public function remove(AbstractModel $model) |
||
155 | } |
||
156 |