1 | <?php defined('SYSPATH') OR die('No direct script access.'); |
||
11 | abstract class Kohana_Jam_Association_Collection extends Jam_Association { |
||
12 | |||
13 | /** |
||
14 | * Find the join table based on the two model names pluralized, |
||
15 | * sorted alphabetically and with an underscore separating them |
||
16 | * |
||
17 | * @param string $model1 |
||
18 | * @param string $model2 |
||
19 | * @return string |
||
20 | */ |
||
21 | 30 | static public function guess_through_table($model1, $model2) |
|
31 | |||
32 | /** |
||
33 | * Assign default forein_model to singular association name |
||
34 | * @param Jam_Meta $meta |
||
35 | * @param string $name |
||
36 | */ |
||
37 | 81 | public function initialize(Jam_Meta $meta, $name) |
|
46 | |||
47 | /** |
||
48 | * Load associated models (from database or after deserialization) |
||
49 | * @param Jam_Validated $model |
||
50 | * @param mixed $value |
||
51 | * @return Jam_Array_Association |
||
52 | */ |
||
53 | 7 | public function load_fields(Jam_Validated $model, $value) |
|
68 | |||
69 | 637 | public function assign_internals(Jam_Validated $model, Jam_Array_Association $collection) |
|
76 | |||
77 | 22 | public function get(Jam_Validated $model, $value, $is_changed) |
|
92 | |||
93 | /** |
||
94 | * Perform checks on all changed items from this collection |
||
95 | * @param Jam_Model $model |
||
96 | */ |
||
97 | 8 | public function model_after_check(Jam_Model $model) |
|
104 | |||
105 | /** |
||
106 | * Persist this collection in the database |
||
107 | * @param Jam_Model $model |
||
108 | */ |
||
109 | 8 | public function model_after_save(Jam_Model $model) |
|
118 | |||
119 | /** |
||
120 | * Use this method to perform special actions when an item is requested from the collection |
||
121 | * @param Jam_Model $model |
||
122 | * @param Jam_Model $item |
||
123 | */ |
||
124 | 1 | public function item_get(Jam_Model $model, Jam_Model $item) |
|
128 | |||
129 | /** |
||
130 | * Use this method to perform special actions when an item is set to the collection |
||
131 | * @param Jam_Model $model |
||
132 | * @param Jam_Model $item |
||
133 | */ |
||
134 | public function item_set(Jam_Model $model, Jam_Model $item) |
||
138 | |||
139 | /** |
||
140 | * Use this method to perform special actions when an item is removed from the collection |
||
141 | * @param Jam_Model $model |
||
142 | * @param Jam_Model $item |
||
143 | */ |
||
144 | public function item_unset(Jam_Model $model, Jam_Model $item) |
||
148 | |||
149 | /** |
||
150 | * A database query used to remove items from the model |
||
151 | * @param array $ids |
||
152 | * @param Jam_Model $model |
||
153 | * @return Database_Query |
||
154 | */ |
||
155 | abstract public function remove_items_query(Jam_Model $model, array $ids); |
||
156 | |||
157 | /** |
||
158 | * A database query used to add items to the model |
||
159 | * @param array $ids |
||
160 | * @param Jam_Model $model |
||
161 | * @return Database_Query |
||
162 | */ |
||
163 | abstract public function add_items_query(Jam_Model $model, array $ids); |
||
164 | |||
165 | /** |
||
166 | * Get the colleciton to get the models of the association |
||
167 | * @param Jam_Model $model |
||
168 | * @return Jam_Query_Builder_Collection |
||
169 | */ |
||
170 | abstract public function collection(Jam_Model $model); |
||
171 | |||
172 | /** |
||
173 | * Execute remove_items_query and add_items_query to persist the colleciton to the datbaase |
||
174 | * @param Jam_Model $model |
||
175 | * @param Jam_Array_Association $collection |
||
176 | */ |
||
177 | 2 | public function save(Jam_Model $model, Jam_Array_Association $collection) |
|
197 | |||
198 | /** |
||
199 | * Use the remove query to remove all items from the collection |
||
200 | * @param Jam_Validated $model |
||
201 | * @param Jam_Array_Association $collection |
||
202 | */ |
||
203 | public function clear(Jam_Validated $model, Jam_Array_Association $collection) |
||
214 | |||
215 | } |
||
216 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.