[FEATURE] Missing extbase declaration for field "static_lang_isocode" 22/51222/2
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 9 Jan 2017 19:09:17 +0000 (14:09 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 9 Jan 2017 19:11:46 +0000 (20:11 +0100)
Adding domain model and repository for system language

Change-Id: Idff2662c669a5a1be45a5ec61d679a762fc64dab
Resolves: #77246
Reviewed-on: https://review.typo3.org/51222
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
ChangeLog
Classes/Domain/Model/SystemLanguage.php [new file with mode: 0644]
Classes/Domain/Repository/SystemLanguageRepository.php [new file with mode: 0644]
Configuration/TypoScript/Extbase/setup.txt

index 323acf2..38da1d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        * Resolves #79223: Standardize SQL table definitions
        * Resolves #79035: Update currency of Baltic states
        * Resolves #77245: Add languages "Swiss" and "Austrian"
+       * Resolves #77246: Missing extbase declaration for field "static_lang_isocode" in sys_language
+
 
 2017-01-08  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
diff --git a/Classes/Domain/Model/SystemLanguage.php b/Classes/Domain/Model/SystemLanguage.php
new file mode 100644 (file)
index 0000000..5a90005
--- /dev/null
@@ -0,0 +1,91 @@
+<?php
+namespace SJBR\StaticInfoTables\Domain\Model;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013-2017 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use SJBR\StaticInfoTables\Domain\Model\Language;
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
+/**
+ * The System Language model
+ */
+class SystemLanguage extends AbstractEntity
+{
+       /**
+        * @var string System language name
+        */
+       protected $title = '';
+
+       /**
+        * @var \SJBR\StaticInfoTables\Domain\Model\Language
+        */
+       protected $isoLanguage = null;
+
+       /**
+        * Sets the language name
+        *
+        * @param string $title
+        * @return void
+        */
+       public function setTitle($title)
+       {
+               $this->title = $title;
+       }
+
+       /**
+        * Gets the backend language name
+        *
+        * @return string
+        */
+       public function getTitle()
+       {
+               return $this->title;
+       }
+
+       /**
+        * Sets the ISO language
+        *
+        * @param Language $isoLanguage
+        * @return void
+        */
+       public function setIsoLanguage(Language $isoLanguage)
+       {
+               $this->isoLanguage = $isoLanguage;
+       }
+
+       /**
+        * Gets the ISO language
+        *
+        * @return Language
+        */
+       public function getIsoLanguage()
+       {
+               if ($this->isoLanguage !== null) {
+                       return clone $this->isoLanguage;
+               } else {
+                       return $this->isoLanguage;
+               }
+       }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/SystemLanguageRepository.php b/Classes/Domain/Repository/SystemLanguageRepository.php
new file mode 100644 (file)
index 0000000..ec2f455
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+namespace SJBR\StaticInfoTables\Domain\Repository;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013-2017 Stanislas Rolland <typo3@sjbr.ca>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
+use TYPO3\CMS\Extbase\Persistence\Repository;
+
+/**
+ * System language repository
+ */
+class SystemLanguageRepository extends Repository
+{
+       /**
+        * Find all system language objects with uid in list
+        * If no list is provided, find all system language objects
+        *
+        * @param string $list: list of uid's
+        * @return QueryResultInterface|array all entries
+        */
+       public function findAllByUidInList($list = '')
+       {
+               if (empty($list)) {
+                       return $this->findAll();
+               } else {
+                       $query = $this->createQuery();
+                       $list = GeneralUtility::trimExplode(',', $list, true);
+                       $query->matching($query->in('uid', $list));
+                       return $query->execute();
+               }
+       }
+}
\ No newline at end of file
index 1611501..fa0d8bc 100644 (file)
@@ -88,6 +88,15 @@ config.tx_extbase {
                                        }
                                }
                        }
+                       SJBR\StaticInfoTables\Domain\Model\SystemLanguage {
+                               mapping {
+                                       tableName = sys_language
+                                       columns {
+                                               title.mapOnProperty = title
+                                               static_lang_isocode.mapOnProperty = isoLanguage
+                                       }
+                               }
+                       }
                }
        }
 }
\ No newline at end of file