[BUGFIX] Follow-up to Avoid exceptions in backend list 17/46717/2
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 16 Feb 2016 15:11:11 +0000 (10:11 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 16 Feb 2016 15:13:47 +0000 (16:13 +0100)
Resolves: #72828
Change-Id: Ia63b05bed0216e1d230bd886872f19f4a4126e3e
Reviewed-on: https://review.typo3.org/46717
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
ChangeLog
Classes/Domain/Repository/CountryRepository.php
Classes/Hook/Backend/Form/FormDataProvider/TcaLabelProcessor.php

index 62182dc..a65030a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2016-02-16  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
        * Resolves #73462: Update of static_info_tables breaks TYPO3 6.2 installation
+       * Resolves #72828: Follow-up to Avoid exceptions in backend list
 
 2016-02-15  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
index 0c62c23..0df6b5b 100644 (file)
@@ -4,7 +4,7 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
 /*
  *  Copyright notice
  *
- *  (c) 2011-2012 Armin Rädiger Vieweg <info@professorweb.de>
+ *  (c) 2011-2012 Armin Rädiger Vieweg <info@professorweb.de>
  *  (c) 2013-2016 Stanislas Rolland <typo3(arobas)sjbr.ca>
  *
  *  All rights reserved
index 8c0e6c9..cac5bb2 100644 (file)
@@ -23,6 +23,10 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
  *  This copyright notice MUST APPEAR in all copies of the script!
  */
 
+use SJBR\StaticInfoTables\Domain\Model\Country;
+use SJBR\StaticInfoTables\Domain\Model\Currency;
+use SJBR\StaticInfoTables\Domain\Model\Language;
+use SJBR\StaticInfoTables\Domain\Model\Territory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -42,7 +46,7 @@ class TcaLabelProcessor
                $PA['title'] = $PA['row'][$GLOBALS['TCA'][$PA['table']]['ctrl']['label']];
                if (TYPO3_MODE == 'BE') {
                        /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
-                       $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+                       $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                        switch ($PA['table']) {
                                case 'static_territories':
                                        $isoCode = $PA['row']['tr_iso_nr'];
@@ -51,7 +55,7 @@ class TcaLabelProcessor
                                                $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
                                                /** @var $territory SJBR\StaticInfoTables\Domain\Model\Territory */
                                                $territory = $territoryRepository->findByUid($PA['row']['uid']);
-                                               if (is_object($territory)) {
+                                               if ($territory instanceof Territory) {
                                                        $isoCode = $territory->getUnCodeNumber();
                                                }
                                        }
@@ -66,7 +70,7 @@ class TcaLabelProcessor
                                                $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
                                                /** @var $country SJBR\StaticInfoTables\Domain\Model\Country */
                                                $country = $countryRepository->findByUid($PA['row']['uid']);
-                                               if (is_object($country)) {
+                                               if ($country instanceof Country) {
                                                        $isoCode = $country->getIsoCodeA2();
                                                }
                                        }
@@ -85,7 +89,7 @@ class TcaLabelProcessor
                                                $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
                                                /** @var $language SJBR\StaticInfoTables\Domain\Model\Language */
                                                $language = $languageRepository->findByUid($PA['row']['uid']);
-                                               if (is_object($language)) {
+                                               if ($language instanceof Language) {
                                                        $isoCodes = array($language->getIsoCodeA2());
                                                        if ($language->getCountryIsoCodeA2()) {
                                                                $isoCodes[] = $language->getCountryIsoCodeA2();
@@ -104,7 +108,7 @@ class TcaLabelProcessor
                                                $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
                                                /** @var $currency SJBR\StaticInfoTables\Domain\Model\Currency */
                                                $currency = $currencyRepository->findByUid($PA['row']['uid']);
-                                               if (is_object($currency)) {
+                                               if ($currency instanceof Currency) {
                                                        $isoCode = $currency->getIsoCodeA3();
                                                }
                                        }