[FLOW3-general] Get identifier of entity object
Kevin Ulrich Moschallski
km at 3digit.de
Thu May 19 11:44:37 CEST 2011
On 2011-05-19 09:29:37 +0200, Karsten Dambekalns said:
> 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
Thanks Karsten, i will change it like you suggested.
Regards,
Kevin
More information about the FLOW3-general
mailing list