1 | <?php |
||
18 | class NodeTranslationRepository extends EntityRepository |
||
19 | { |
||
20 | /** |
||
21 | * Get the QueryBuilder based on node id and language. |
||
22 | * |
||
23 | * @deprecated This method is deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Use the renamed method "getNodeTranslationByNodeId" instead. |
||
24 | * |
||
25 | * @param int $nodeId |
||
26 | * @param string $lang |
||
27 | * |
||
28 | * @return NodeTranslation|null |
||
29 | */ |
||
30 | public function getNodeTranslationByNodeIdQueryBuilder($nodeId, $lang) |
||
36 | |||
37 | /** |
||
38 | * @return NodeTranslation|null |
||
39 | */ |
||
40 | public function getNodeTranslationByNodeId(int $nodeId, string $lang) |
||
56 | |||
57 | /** |
||
58 | * Get max children weight |
||
59 | * |
||
60 | * @param Node $parentNode |
||
61 | * @param string $lang (optional) Only return max weight for the |
||
62 | * given language |
||
63 | * |
||
64 | * @return int |
||
65 | */ |
||
66 | public function getMaxChildrenWeight(Node $parentNode = null, $lang = null) |
||
77 | |||
78 | /** |
||
79 | * QueryBuilder to fetch node translations (ignoring nodes that have been |
||
80 | * deleted) |
||
81 | * |
||
82 | * @param string $lang (optional) Only return NodeTranslations for the |
||
83 | * given language |
||
84 | * |
||
85 | * @return \Doctrine\ORM\QueryBuilder |
||
86 | */ |
||
87 | public function getNodeTranslationsQueryBuilder($lang = null) |
||
110 | |||
111 | /** |
||
112 | * QueryBuilder to fetch node translations that are currently published |
||
113 | * (ignoring nodes that have been deleted) |
||
114 | * |
||
115 | * @param string $lang (optional) Only return NodeTranslations for the |
||
116 | * given language |
||
117 | * |
||
118 | * @return \Doctrine\ORM\QueryBuilder |
||
119 | */ |
||
120 | public function getOnlineNodeTranslationsQueryBuilder($lang = null) |
||
125 | |||
126 | /** |
||
127 | * QueryBuilder to fetch immediate child NodeTranslations for a specific |
||
128 | * node and (optional) language |
||
129 | * |
||
130 | * @return \Doctrine\ORM\QueryBuilder |
||
131 | */ |
||
132 | public function getChildrenQueryBuilder(Node $parent, $lang = null) |
||
138 | |||
139 | /** |
||
140 | * QueryBuilder to fetch immediate child NodeTranslations for a specific |
||
141 | * node and (optional) language that are currently published |
||
142 | * |
||
143 | * @return \Doctrine\ORM\QueryBuilder |
||
144 | */ |
||
145 | public function getOnlineChildrenQueryBuilder(Node $parent, $lang = null) |
||
150 | |||
151 | /** |
||
152 | * Get all online child node translations for a given node and (optional) |
||
153 | * language |
||
154 | * |
||
155 | * @param Node $parent |
||
156 | * @param string $lang (optional, if not specified all languages will be |
||
157 | * returned) |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | public function getOnlineChildren(Node $parent, $lang = null) |
||
166 | |||
167 | /** |
||
168 | * Finds all nodetranslations where title is like the given $title parameter |
||
169 | * |
||
170 | * @param string $title |
||
171 | * @param string $lang (optional, if not specified all languages will be |
||
172 | * returned) |
||
173 | * |
||
174 | * @return array |
||
175 | */ |
||
176 | public function getNodeTranslationsLikeTitle($title, $lang = null) |
||
185 | |||
186 | /** |
||
187 | * Get the node translation for a node |
||
188 | * |
||
189 | * @param HasNodeInterface $hasNode |
||
190 | * |
||
191 | * @return NodeTranslation |
||
192 | */ |
||
193 | public function getNodeTranslationFor(HasNodeInterface $hasNode) |
||
206 | |||
207 | /** |
||
208 | * Get the node translation for a given slug string |
||
209 | * |
||
210 | * @param string $slug The slug |
||
211 | * @param NodeTranslation|null $parentNode The parentnode |
||
212 | * |
||
213 | * @return NodeTranslation|null |
||
214 | */ |
||
215 | public function getNodeTranslationForSlug( |
||
231 | |||
232 | /** |
||
233 | * Returns the node translation for a given slug |
||
234 | * |
||
235 | * @param NodeTranslation|null $parentNode The parentNode |
||
236 | * @param string $slugPart The slug part |
||
237 | * |
||
238 | * @return NodeTranslation|null |
||
239 | */ |
||
240 | private function getNodeTranslationForSlugPart( |
||
275 | |||
276 | /** |
||
277 | * Get the node translation for a given url |
||
278 | * |
||
279 | * @param string $urlSlug The full url |
||
280 | * @param string $locale The locale |
||
281 | * @param bool $includeDeleted Include deleted nodes |
||
282 | * @param NodeTranslation $toExclude Optional NodeTranslation instance |
||
283 | * you wish to exclude |
||
284 | * @param Node $rootNode Optional Root node of the tree you |
||
285 | * wish to use |
||
286 | * |
||
287 | * @return array |
||
288 | */ |
||
289 | public function getAllNodeTranslationsForUrl( |
||
339 | |||
340 | /** |
||
341 | * Get the node translation for a given url |
||
342 | * |
||
343 | * @param string $urlSlug The full url |
||
344 | * @param string $locale The locale |
||
345 | * @param bool $includeDeleted Include deleted nodes |
||
346 | * @param NodeTranslation $toExclude Optional NodeTranslation instance |
||
347 | * you wish to exclude |
||
348 | * @param Node $rootNode Optional Root node of the tree you |
||
349 | * wish to use |
||
350 | * |
||
351 | * @return NodeTranslation|null |
||
352 | */ |
||
353 | public function getNodeTranslationForUrl( |
||
368 | |||
369 | /** |
||
370 | * Get all top node translations |
||
371 | * |
||
372 | * @return NodeTranslation[] |
||
373 | */ |
||
374 | public function getTopNodeTranslations() |
||
390 | |||
391 | /** |
||
392 | * Create a node translation for a given node |
||
393 | * |
||
394 | * @param HasNodeInterface $hasNode The hasNode |
||
395 | * @param string $lang The locale |
||
396 | * @param Node $node The node |
||
397 | * @param BaseUser $owner The user |
||
398 | * |
||
399 | * @throws \InvalidArgumentException |
||
400 | * |
||
401 | * @return NodeTranslation |
||
402 | */ |
||
403 | public function createNodeTranslationFor( |
||
441 | |||
442 | /** |
||
443 | * Add a draft node version for a given node |
||
444 | * |
||
445 | * @param HasNodeInterface $hasNode The hasNode |
||
446 | * @param string $lang The locale |
||
447 | * @param Node $node The node |
||
448 | * @param BaseUser $owner The user |
||
449 | * |
||
450 | * @throws \InvalidArgumentException |
||
451 | * |
||
452 | * @return NodeTranslation |
||
453 | */ |
||
454 | public function addDraftNodeVersionFor( |
||
482 | |||
483 | /** |
||
484 | * Find best match for given URL and locale |
||
485 | * |
||
486 | * @param string $urlSlug The slug |
||
487 | * @param string $locale The locale |
||
488 | * |
||
489 | * @return NodeTranslation |
||
490 | */ |
||
491 | public function getBestMatchForUrl($urlSlug, $locale) |
||
515 | |||
516 | /** |
||
517 | * Test if all parents of the specified NodeTranslation have a node |
||
518 | * translation for the specified language |
||
519 | * |
||
520 | * @param NodeTranslation $nodeTranslation The node translation |
||
521 | * @param string $language The locale |
||
522 | * |
||
523 | * @return bool |
||
524 | */ |
||
525 | public function hasParentNodeTranslationsForLanguage( |
||
547 | |||
548 | /** |
||
549 | * This will return 1 NodeTranslation by default (if one exists). |
||
550 | * Just give it the internal name as defined on the Node in the database |
||
551 | * and the language. |
||
552 | * |
||
553 | * It'll only return the latest version. It'll also hide deleted & offline |
||
554 | * nodes. |
||
555 | * |
||
556 | * @param $language |
||
557 | * @param $internalName |
||
558 | */ |
||
559 | public function getNodeTranslationByLanguageAndInternalName( |
||
585 | |||
586 | public function getAllNodeTranslationsByRefEntityName($refEntityName) |
||
597 | |||
598 | public function getParentNodeTranslation(NodeTranslation $nodeTranslation) |
||
617 | } |
||
618 |
If you suppress an error, we recommend checking for the error condition explicitly: