Bug #70034
closed
Problem with makeCategorizable in TYPO3 6.2.15
Added by Krzysztof Kasprzyca about 9 years ago.
Updated about 9 years ago.
Description
Hello
I have problem with my extension "amt_feed_importer". I use 'makeCategorizable' function in TCA configuration (file Configuration/TCA/Feed.php) for 'categories' field. In TYPO3 6.2.14 everything works fine but if I change version to 6.2.15 the tree is not available. Should it work like this and problem is on my side or not? I think it could be related with #67881
I attached actual code of my extension
Files
Hy Krzysztof,
thank you for your report.
I think you are using the makeCategorizable()
call in the wrong file.
Please use it in TCA/Overrides/Feed.php
or ext_tables.php
as described here: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Categories/Index.html
The second way is to call \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(). This method adds a new entry into the registry managed by \TYPO3\CMS\Core\Category\CategoryRegistry. The registry will take care of adding the relevant $TCA definition to create a field for making relations to the system categories. The call to makeCategorizable() must be located in an extension's ext_tables.php file or (since TYPO3 CMS 6.2.1) in a file from the Configuration/TCA/Overrides folder.
I hope this helps.
Cheers,
Alex
- Status changed from New to Needs Feedback
Its seems like a user error.
ext_tables.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
$_EXTKEY,
'...._domain_model_feed'
);
----
TCA no edit needed - no category or something else - TYPO3 do it self----
Domain/Model/Feed.php
/**
* Categories
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
*/
protected $categories = NULL;
/**
* Returns the categories
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> $categories
*/
public function getCategories() {
return $this->categories;
}
/**
* Sets the categories
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> $categories
* @return void
*/
public function setCategories(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories) {
$this->categories = $categories;
}
It works for me fine in 6.2 - so please try my code.
Hope it help you.
Robert.
Alexander Stehlik wrote:
Hy Krzysztof,
thank you for your report.
I think you are using the makeCategorizable()
call in the wrong file.
Please use it in TCA/Overrides/Feed.php
or ext_tables.php
as described here: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Categories/Index.html
The second way is to call \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(). This method adds a new entry into the registry managed by \TYPO3\CMS\Core\Category\CategoryRegistry. The registry will take care of adding the relevant $TCA definition to create a field for making relations to the system categories. The call to makeCategorizable() must be located in an extension's ext_tables.php file or (since TYPO3 CMS 6.2.1) in a file from the Configuration/TCA/Overrides folder.
I hope this helps.
Cheers,
Alex
Thanks Alex, of course it helps
- Status changed from Needs Feedback to Closed
As I read your message you found your solution. I'll close this issue now.
Also available in: Atom
PDF