Bug #69563
closedAutoloader looks in wrong directory for class files
0%
Description
I stumbeld upon this issue setting in my controller
protected $viewFormatToObjectNameMap = array( 'json' => 'Thucke\ThRating\View\JsonView', );
Normally I would expect that I have to put the file in my extension directory
EXT:th_rating/Classes/View/JsonView.php
... that doesn't work.
I figured out that TYPO3 instead looks for the following file
typo3\vendor\typo3\cms-composer-installers\Classes\Thucke\ThRating\View\JsonView.php
I'd assume that the autoloader might have a bug there.
But I'm sure you guys will find the right point to change ...
Thanks
Thomas
Files
Updated by Stephan Großberndt about 9 years ago
- Category changed from 1597 to composer
- Target version deleted (
7.5)
Updated by Wouter Wolters about 9 years ago
- Status changed from New to Needs Feedback
How do you register your module/plugin?
Updated by Thomas Hucke about 9 years ago
Hi Wouter,
thanks for your quick response.
It's the normal way registering an extbase extension:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'Thucke.' . $_EXTKEY, // The extension name (in UpperCamelCase) or the extension key (in lower_underscore) 'Pi1', // A unique name of the plugin in UpperCamelCase array( // An array holding the controller-action-combinations that are accessible 'Vote' => 'ratinglinks,polling,mark,index,show,create,new,singleton', // The first controller and its first action will be the default ), array( // An array of non-cachable controller-action-combinations (they must already be enabled) 'Vote' => 'new,create,ratinglinks,polling,mark', ) );
You may download my extension "Rating AX" from TER.
I'm trying to add JSON responses for the AJAX requests. This isn't included in the TER version yet.
Updated by Helmut Hummel about 9 years ago
Thomas Hucke wrote:
I stumbeld upon this issue setting in my controller
You added a new class file to your extension?
I figured out that TYPO3 instead looks for the following file
How did you find that out?
I'd assume that the autoloader might have a bug there.
But I'm sure you guys will find the right point to change ...
For now, if you do not have a composer.json with a PSR-4 section defined, you need to execute
typo3/cli_dispatch.phpsh extbase extension:dumpclassloadinginformation
after you add a class to your extension.
In future versions you will be able to set up such a PSR-4 section in your ext_emconf.php, but this is not possible yet.
Updated by Thomas Hucke about 9 years ago
Helmut Hummel wrote:
You added a new class file to your extension?
Yes, the new JSON view which is being referenced in the controller.
How did you find that out?
I used to check at which files the webserver is looking for when I execute the extension.
On windows there's a nice tool called "process monitor" which does a good job for that.
For now, if you do not have a composer.json with a PSR-4 section defined, you need to execute [...]
after you add a class to your extension.
Thanks - I'll try it out soon.
Updated by Helmut Hummel about 9 years ago
- Status changed from Needs Feedback to Rejected
- Assignee deleted (
Anja Leichsenring)
Thomas Hucke wrote:
Yes, the new JSON view which is being referenced in the controller.
OK, then that is why the new class is not found.
How did you find that out?
I used to check at which files the webserver is looking for when I execute the extension.
On windows there's a nice tool called "process monitor" which does a good job for that.
Yeah, the class loader might look in several places when the class is not in the map
For now, if you do not have a composer.json with a PSR-4 section defined, you need to execute [...]
after you add a class to your extension.Thanks - I'll try it out soon.
Feel free to add comments here if you have troubles with that. But I'll close the ticket now.
As said, we'll improve the situation by adding the autoload section also to ext_emconf.php
Until then you can improve the handling for yourself by adding a composer.json file with a PSR-4 section.
Here an example what is needed in such a composer.json file (and a description what section is what for) https://github.com/helhum/ext_scaffold
Updated by Thomas Hucke about 9 years ago
- File composer.json composer.json added
Hi Helmut,
I've created a composer.json file using the template of your ext_scaffold example.
Even it's being well documented and seems to be as easy as it can be ... MY composer.json doesn't semm to work properly.
It'd be great if you could have a look at it (see attachment) and give me a hint what's going wrong.
Thank you
Thomas
Updated by Thomas Hucke about 9 years ago
- File composer.json composer.json added
Hi Helmut,
this file now works.
I removed some entries of the former file which was based on the template you've referenced.
Have no clue what've been the issue in the former file.
Thank you
Thomas