[Flow] Converting Objects by additional identity does not work?

Carsten Bleicker carsten at bleicker.de
Wed Mar 5 13:40:40 CET 2014


but why this exists in persistent object converter?
\TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter::findObjectByIdentityProperties
this exactly seems to do what i want. but only if an array with identities comes in.
seems not to work if string with foreign id comes in.


Am 05.03.2014 um 13:27 schrieb Christian Loock <brainshack at gmail.com>:

> Here is what the documentation of the Identity Annotation states:
> 
> Identity<http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartV/AnnotationReference.html#identity>
> 
> Marks a property as being *(part of)* the identity of an object.
> 
> If multiple properties are annotated as Identity, a compound identity is
> created.
> 
> For Doctrine a unique key over all involved properties will be created -
> thus the limitations of that need to be observed.
> 
> 
> 
> Addding another @Identity field will only add it to the primary key. Thusly
> Flow cant be able to retrieve an Object by just supplying a part of it.
> 
> 
> In you case, I would just add a method to the Repository Class
> GetThingyByForeignId to which you supply the foreign ID which will then
> return the desired Entity. Your action would then receive the foreign ID as
> a string and load the entity with GetThingyByForeignId.
> 
> 
> 2014-03-05 13:12 GMT+01:00 Carsten Bleicker <carsten at bleicker.de>:
> 
>> Runnig a test in the frontend with a test action wich redirects me to the
>> show action of a given artist works:
>> 
>> 1.) $this->redirect('show',array('resource' => $foo)) results in:
>> 
>> http://development.artmanager.local/foo/artist/test/fc700953-8911-9432-542e-968b7bff43e3
>> Status 200
>> 
>> 2.) $this->redirect('show',array('resource' =>
>> $foo->getForeignIdentity())) results in:
>> http://development.artmanager.local/foo/artist/test/5317133a3e1bb <--
>> foreignIdentity wich is also a @Flow\Identity
>> Status 500
>> #1297933823: Object with identity "5317133a3e1bb" not found.
>> 
>> 
>> Am 05.03.2014 um 12:14 schrieb Carsten Bleicker <carsten at bleicker.de>:
>> 
>>> hi folks,
>>> having an entity with the default flow persistence identity and also
>> another identity:
>>> 
>>> // @Flow\Entity
>>> class Foo{
>>> 
>>>      /**
>>>      * @var string
>>>      * @Flow\Identity
>>>      */
>>>      protected $foreignIdentity;
>>> 
>>> }
>>> 
>>> 
>>> my routing:
>>> -
>>>      name: 'Read Action with foreignIdentity as {foo}'
>>>      uriPattern: 'rest/{foo}'
>>>      httpMethods: ['GET']
>>>      defaults:
>>>              '@package':    'Foo.Bar'
>>>              '@controller': 'Foo'
>>>              '@action':     'read'
>>>              '@format':     'json'
>>> 
>>> 
>>> I would expect that my controller receives the mapped entity, detected
>> either by its foreignIdentity or by its flow_persistence_identifier.
>>> But only flow_persistence_identifier works.
>>> 
>>> Am i wron with my expectation?
>>> _______________________________________________
>>> Flow mailing list
>>> Flow at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>> 
>> _______________________________________________
>> Flow mailing list
>> Flow at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>> 
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow



More information about the Flow mailing list