Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use standard fields like crdate and cruser_id with TYPO3 and extbase?

I have the domain models Basket and Article. If I call the following I receive the articles in the basket.

$articlesInBasket = $basket->getArticles();

How can I use the TYPO3 standard attributes like crdate and cruser_id. It would be nice to use something like this:

$basket->getCrUser();
$basket->getCrDate();
like image 665
koalabruder Avatar asked Dec 05 '12 22:12

koalabruder


1 Answers

This works in TYPO3 8.7 and 9.5

model:

/**
 * @var \DateTime
 */
protected $crdate = null;


/**
 * Returns the creation date
 *
 * @return \DateTime $crdate
 */
public function getCrdate()
{
    return $this->crdate;
}

TCA -> add this in the colums;

'columns' => [
    'crdate' => [
        'config' => [
            'type' => 'passthrough',
        ],
    ],

    ...

]
like image 92
webMan Avatar answered Sep 25 '22 09:09

webMan