ext_autoload hack

ext_autoload.php requires class names to be lower case which sometimes makes it ugly to copy and paste missing file names into it. Here is a little hack on how to prevent this.

<?php

$ptSolrBasePath = t3lib_extMgm::extPath('pt_solr');
$classesBasePath = $ptSolrBasePath . 'Classes/';
$testsBasePath = $ptSolrBasePath . 'Tests/';

$classesToBeAutoloaded = array(
	'Tx_PtSolr_Tests_BaseTestcase' => $testsBasePath . 'BaseTestcase.php',
	'Tx_PtSolr_Controller_AbstractActionController' => $classesBasePath . 'Controller/AbstractActionController.php'
);


// Autoloader only works with lowercased class names which makes Copy&Paste a mess here
$lowerCasedClassesToBeAutoloaded = array();

foreach ($classesToBeAutoloaded as $classNameUpperCase => $path) {
	$lowerCasedClassesToBeAutoloaded[strtolower($classNameUpperCase)] = $path;
}

return $lowerCasedClassesToBeAutoloaded;

?>

 
Inhalt © Michael Knoll 2009-2017  •  Powered by TYPO3  •  TypoScript Blogging by Fabrizio Branca  •  TYPO3 Photo Gallery Management by yag  •  Impressum