1 | <?php |
||
23 | class PostingBehavior extends Behavior |
||
24 | { |
||
25 | /** @var CurrentUserInterface */ |
||
26 | private $CurrentUser; |
||
27 | |||
28 | /** @var FieldFilter */ |
||
29 | private $fieldFilter; |
||
30 | |||
31 | /** |
||
32 | * {@inheritDoc} |
||
33 | */ |
||
34 | public function initialize(array $config) |
||
40 | |||
41 | /** |
||
42 | * Creates a new posting from user |
||
43 | * |
||
44 | * @param array $data raw posting data |
||
45 | * @param CurrentUserInterface $CurrentUser the current user |
||
46 | * @return Entry|null on success, null otherwise |
||
47 | */ |
||
48 | public function createPosting(array $data, CurrentUserInterface $CurrentUser): ?Entry |
||
80 | |||
81 | /** |
||
82 | * Updates an existing posting |
||
83 | * |
||
84 | * @param Entry $posting the posting to update |
||
85 | * @param array $data data the posting should be updated with |
||
86 | * @param CurrentUserInterface $CurrentUser the current-user |
||
87 | * @return Entry the posting which was asked to update |
||
88 | */ |
||
89 | public function updatePosting(Entry $posting, array $data, CurrentUserInterface $CurrentUser): Entry |
||
118 | |||
119 | /** |
||
120 | * Populates data of an answer derived from parent the parent-posting |
||
121 | * |
||
122 | * @param BasicPostingInterface $parent parent data |
||
123 | * @param array $data current posting data |
||
124 | * @return array populated $data |
||
125 | */ |
||
126 | public function prepareChildPosting(BasicPostingInterface $parent, array $data): array |
||
138 | |||
139 | /** |
||
140 | * Sets-up validator for the table |
||
141 | * |
||
142 | * @param CurrentUserInterface $CurrentUser current user |
||
143 | * @return void |
||
144 | */ |
||
145 | private function validatorSetup(CurrentUserInterface $CurrentUser): void |
||
155 | |||
156 | /** |
||
157 | * check that entries are only in existing and allowed categories |
||
158 | * |
||
159 | * @param mixed $categoryId value |
||
160 | * @param array $context context |
||
161 | * @return bool |
||
162 | */ |
||
163 | public function validateCategoryIsAllowed($categoryId, $context): bool |
||
171 | |||
172 | /** |
||
173 | * check editing allowed |
||
174 | * |
||
175 | * @param mixed $check value |
||
176 | * @param array $context context |
||
177 | * @return bool |
||
178 | */ |
||
179 | public function validateEditingAllowed($check, $context): bool |
||
185 | } |
||
186 |