I'm just trying to extend the sys_category table with a new field "page" just the normal extbase way. Worked like a charm, field shows up and is saved in DB. But there is no field in my f:debug in Fluid. Anyone got an idea what is missing?
Thanks a lot for any help!
TCA Override:
$newColumns = [
'page' => [
'exclude' => true,
'label' => 'LLL:EXT:project/Resources/Private/Language/Default/locallang_db.xlf:sys_category.page',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => 1,
'maxitems' => 1,
'minitems' => 0
]
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_category', $newColumns);
// Make fields visible in the TCEforms:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'sys_category', // Table name
'page', // Field list to add
'1', // List of specific types to add the field list to. (If empty, all type entries are affected)
'after:title' // Insert fields before (default) or after one, or replace a field
);
SQL:
#
# Table structure for table 'sys_category'
#
CREATE TABLE sys_category (
page int(11),
);
Model:
<?php
namespace <Vendorname>\Project\Domain\Model;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
/**
* Class Category
* @package <Vendorname>\Project
*/
class Category extends \TYPO3\CMS\Extbase\Domain\Model\Category
{
/**
* @var integer
*/
protected $page = null;
/**
* Gets the page.
*
* @return integer
* @api
*/
public function getPage()
{
return $this->page;
}
/**
* Sets the page.
*
* @param integer $page
* @api
*/
public function setPage($page)
{
$this->page = $page;
}
}
Typoscript Setup:
config.tx_extbase.persistence {
storagePid = {$plugin.tx_project.persistence.storagePid}
classes {
TYPO3\CMS\Extbase\Domain\Model\Category {
subclasses {
<Vendorname>\Project\Domain\Model\Category = <Vendorname>\Project\Domain\Model\Category
}
}
<Vendorname>\Project\Domain\Model\Category {
mapping {
tableName = sys_category
}
}
}
}