[TYPO3-mvc] Tstamp and Crdate

Pankaj Lele pankaj at lelesys.com
Mon Feb 28 17:34:29 CET 2011


Hi

> how can access in fluid the common field tstamp and crdate in the
> FrontendUser Model of extbase?
> Is that possible at the moment?
> Do i have to implement it?

It looks like there is no provision in ExtBase to access these columns 
automatically. You have to implement it. I just did a quick test with 
blog_example and it worked. Following is the code:

1. You have to extend Tx_Extbase_Domain_Model_FrontendUser

/**
  * An Administrator of a Blog
  */
class Tx_BlogExample_Domain_Model_Administrator extends 
Tx_Extbase_Domain_Model_FrontendUser {
	/**
	 * Last modified time
	 *
	 * @var int
	 */
	protected $tstamp;
	

	/**
	 * Returns tstamp
	 *
	 * @return int tstamp
	 */
	public function getTstamp() {
		return $this->tstamp;
	}
}

2. Update mapping for tstamp field in TS as it does not conform to 
naming convention:

config.tx_extbase.persistence.classes.Tx_Extbase_Domain_Model_FrontendUser.mapping.columns.tstamp.mapOnProperty 
= tstamp

3. Now you can use tstamp e.g.

<f:format.date format="d:m:Y 
H:i">@{blog.administrator.tstamp}</f:format.date>

Had some little time free so did it for you :)

-- 

With best regards,
Pankaj Lele
---------------------------

CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India

Web: http://www.lelesys.com

[Certified TYPO3 Integrator]


More information about the TYPO3-project-typo3v4mvc mailing list