[FLOW3-general] Get identifier of entity object

Karsten Dambekalns karsten at typo3.org
Thu May 19 09:29:37 CEST 2011


Hi.

On 16.05.11 23:18, Kevin Ulrich Moschallski wrote:
> i'm currently experimenting with flow3 and extdirect. I know want to
> select an object by it's identifier. Therefore i added this to my model:

> /**
>      * The portal's identity
>      * @var string
>      * @identity
This marks this as an identity property, but what you are using is the
technical identifier - not the same thing!
>      * @transient
>      */
>     protected $identifier;

The while property declaration is unused, as the getter asks the PM
directly.

>         return $this->persistenceManager->getIdentifierByObject($this);

This is fine, but as Sebastian said, don't do this in your domain model.

If you ever need some unique identifier in your domain model that is not
present in the "real world" (like e.g. a social security number would
be), then add another property and create your identifier in the
constructor (see the TYPP3CR Node for an example).

Regards,
Karsten


More information about the FLOW3-general mailing list