1 | <?php |
||
8 | abstract class AbstractModelNameGenerator extends AbstractNameGenerator { |
||
9 | |||
10 | /** |
||
11 | * Generates a name with a given type and based on the object type |
||
12 | * |
||
13 | * @param string $type |
||
14 | * @param Table|Relationship $object |
||
15 | * @return string|null Returns the name or null if the type or object is unknown |
||
16 | */ |
||
17 | public function generate($type, $object) { |
||
26 | |||
27 | /** |
||
28 | * Generates a name for a model action with a given type |
||
29 | * |
||
30 | * @param string $type |
||
31 | * @param Table $model |
||
32 | * @return string|null Returns the name or null if the type is unknown |
||
33 | */ |
||
34 | public function generateModel($type, Table $model) { |
||
54 | |||
55 | /** |
||
56 | * Generates a name for a model create type |
||
57 | * |
||
58 | * @param Table $model |
||
59 | * @return string |
||
60 | */ |
||
61 | abstract public function generateModelCreate(Table $model); |
||
62 | |||
63 | /** |
||
64 | * Generates a name for a model read type |
||
65 | * |
||
66 | * @param Table $model |
||
67 | * @return string |
||
68 | */ |
||
69 | abstract public function generateModelRead(Table $model); |
||
70 | |||
71 | /** |
||
72 | * Generates a name for a model paginate type |
||
73 | * |
||
74 | * @param Table $model |
||
75 | * @return string |
||
76 | */ |
||
77 | abstract public function generateModelPaginate(Table $model); |
||
78 | |||
79 | /** |
||
80 | * Generates a name for a model update type |
||
81 | * |
||
82 | * @param Table $model |
||
83 | * @return string |
||
84 | */ |
||
85 | abstract public function generateModelUpdate(Table $model); |
||
86 | |||
87 | /** |
||
88 | * Generates a name for a model delete type |
||
89 | * |
||
90 | * @param Table $model |
||
91 | * @return string |
||
92 | */ |
||
93 | abstract public function generateModelDelete(Table $model); |
||
94 | |||
95 | /** |
||
96 | * Generates a name for a relationship action with a given type |
||
97 | * |
||
98 | * @param string $type |
||
99 | * @param Relationship $relationship |
||
100 | * @return string|null Returns the name or null if the type is unknown |
||
101 | */ |
||
102 | public function generateRelationship($type, Relationship $relationship) { |
||
119 | |||
120 | /** |
||
121 | * Generates a name for a relationship read type |
||
122 | * |
||
123 | * @param Relationship $relationship |
||
124 | * @return string |
||
125 | */ |
||
126 | abstract public function generateRelationshipRead(Relationship $relationship); |
||
127 | |||
128 | /** |
||
129 | * Generates a name for a relationship update type |
||
130 | * |
||
131 | * @param Relationship $relationship |
||
132 | * @return string |
||
133 | */ |
||
134 | abstract public function generateRelationshipUpdate(Relationship $relationship); |
||
135 | |||
136 | /** |
||
137 | * Generates a name for a relationship add type |
||
138 | * |
||
139 | * @param Relationship $relationship |
||
140 | * @return string |
||
141 | */ |
||
142 | abstract public function generateRelationshipAdd(Relationship $relationship); |
||
143 | |||
144 | /** |
||
145 | * Generates a name for a relationship remove type |
||
146 | * |
||
147 | * @param Relationship $relationship |
||
148 | * @return string |
||
149 | */ |
||
150 | abstract public function generateRelationshipRemove(Relationship $relationship); |
||
151 | |||
152 | } |