From fc960a68c375ecf574c6d25a4c2d337b65633975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Tue, 19 Feb 2019 08:33:33 +0100 Subject: [PATCH] EZP-30006: As a Developer I possibility to load several languages at once (#2524) Introduces API to load several languages at once (specifically by id or locale), exposes more specific methods on languageMask handler and in SPI to make language handling more efficient. --- Persistence/Content/Language/Handler.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Persistence/Content/Language/Handler.php b/Persistence/Content/Language/Handler.php index d6481021b..37a711756 100644 --- a/Persistence/Content/Language/Handler.php +++ b/Persistence/Content/Language/Handler.php @@ -42,6 +42,18 @@ public function update(Language $struct); */ public function load($id); + /** + * Get list of languages by id. + * + * Missing items (NotFound) will be missing from the returned iterable and not cause an exception, it's up + * to calling logic to determine if this should cause exception or not. + * + * @param array $ids + * + * @return \eZ\Publish\SPI\Persistence\Content\Language[]|iterable + */ + public function loadList(array $ids): iterable; + /** * Get language by Language Code (eg: eng-GB). * @@ -53,6 +65,18 @@ public function load($id); */ public function loadByLanguageCode($languageCode); + /** + * Get list of languages by Language Code (eg: eng-GB). + * + * Missing items (NotFound) will be missing from the returned iterable and not cause an exception, it's up + * to calling logic to determine if this should cause exception or not. + * + * @param string[] $languageCodes + * + * @return \eZ\Publish\SPI\Persistence\Content\Language[]|iterable + */ + public function loadListByLanguageCodes(array $languageCodes): iterable; + /** * Get all languages. *