0
votes

I want to add additional Fields to the TYPO3 File Collection.
I tried it with this Documentation and added my fields to the TCA and the DB. This works fine as long as I'm only in the Backend. But in Fluid I can't access my news Fields.
The next step was that I tried to extend the model to have a getter and setter for my field, and set extbase to use my model Class. But TYPO3 ignores it.

StaticFileCollection.php

class StaticFileCollection extends \TYPO3\CMS\Core\Resource\Collection\StaticFileCollection
{
/**
 * Subheader
 *
 * @var string
 */
protected $subheader = '';

/**
 * Returns the subheader
 *
 * @return string $subheader
 */
public function getSubheader()
{
    return $this->subheader;
}

/**
 * Sets the subheader
 *
 * @param string $subheader
 * @return void
 */
public function setSubheader($subheader)
{
    $this->subheader = $subheader;
}
}

setup.txt

config.tx_extbase {
objects {
    TYPO3\CMS\Core\Resource\Collection\StaticFileCollection {
        className = MyNamespace\MyExtension\Domain\Model\StaticFileCollection
    }
}
}

What did I missed?

1

1 Answers

0
votes

Your setup should look like:

config.tx_extbase{
    objects {
        TYPO3\CMS\Extbase\Domain\Model\Category.className = VENDOR\Extension\Domain\Model\Category
    }
    persistence.classes {
        VENDOR\Extension\Domain\Model\Category {
            mapping {
                tableName = sys_category
            }
        }
    }
}