[TYPO3-english] XClassing again
Tomasz Krawczyk
tomkrawc at gmail.com
Fri Mar 29 10:15:10 CET 2013
Hello Kay,
I know the difference between 4.x and 6.x
(http://forum.typo3.org/index.php/t/194848/). I successively xclassed
those classes:
<?php
$extPath = t3lib_extMgm::extPath('imagickimg');
return array(
'ux_GraphicalFunctions' => $extPath .
'Classes/Xclass/GraphicalFunctions.php',
'ux_GifBuilder' => $extPath . 'Classes/Xclass/GifBuilder.php',
'ux_ThumbnailView' => $extPath . 'Classes/Xclass/ThumbnailView.php',
'ux_LocalPreviewHelper' => $extPath .
'Classes/Xclass/LocalPreviewHelper.php',
'ux_ContentObjectRenderer' => $extPath .
'Classes/Xclass/ContentObjectRenderer.php',
'ux_ElementInformationController' => $extPath .
'Classes/Xclass/ElementInformationController.php'
);
?>
But I have problem with LocalPreviewHelper class. This class is
instanitated in LocalImageProcessor::getHelperByTaskName by makeInstance
with "$this" as second parameter.
My ux_LocalPreviewHelper has devLog entries inside but I don't see this
in the "Developer Log" browser.
I also tried to overload the constructor and invoke parent constructor
but this leads to an Exception: "#1: PHP Catchable Fatal Error: Argument
1 passed to ux_LocalPreviewHelper::__construct() must be an instance of
LocalImageProcessor, instance of
TYPO3\CMS\Core\Resource\Processing\LocalImageProcessor given in
D:\wamp\www\mysite.local\typo3conf\ext\imagickimg\Classes\Xclass\LocalPreviewHelper.php
line 37 "
This is how beginning of my ux_LocalPreviewHelper looks:
<?php
use \TYPO3\CMS\Core\Resource, \TYPO3\CMS\Core\Utility;
class ux_LocalPreviewHelper extends
\TYPO3\CMS\Core\Resource\Processing\LocalPreviewHelper {
private $extKey = 'imagickimg';
public function __construct(LocalImageProcessor $processor) {
parent::__construct($processor);
}
public function process(TaskInterface $task) {
if (TYPO3_DLOG)
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog(__METHOD__,
$this->extKey);
$targetFile = $task->getTargetFile();
If I comment out the constructor then I see no exceptions but there are
also no devLog entries and no images too.
I'm checking if my XClasses are loaded in ADMIN TOOLS -> Configuration
-> $TYPO3_CONF_VARS->SYS->Objects.
Any ideas appreciated.
cheers
Tomasz
W dniu 2013-03-29 09:38, Kay Strobach pisze:
> Hello Tomasz,
>
> there is a different between TYPO3 4.5 and 6.0!
>
> http://wiki.typo3.org/Xclass
>
> It's important, that prior 6.0 each class needs the xclass loop. In 6.0
> you may use the autoloading mechanism for xclassing ;)
>
> Xclassing is only working if you use t3lib_div::makeInstance.
> Xclasses are ignored by "new".
>
> In the reports module you should find a list of your defined xclasses.
> Ensure a proper ext_autoload file!
>
> Regards
> Kay
>
> Am 28.03.13 20:49, schrieb Tomasz Krawczyk:
>>>> is it possible to XClass a class which takes some parameters in its
>>>> constructor?
>>>>
>>>
>>> Most times, yes, but the interface must be equal!
More information about the TYPO3-english
mailing list