[Flow] Persistence problems after implementing an image field with TYPO3.Media
Christian Müller
christian.mueller at typo3.org
Tue Aug 13 18:09:55 CEST 2013
> thank you for this hint! You are my hero!
No problem glad we could help ;)
> I'm still fixing my errors, but it seems to work with manually persisting the changes. Do you have a personal recommendation for deleting objects from the database? Should this be done by using a POST-request or is manually triggering the persistAll() a common workflow?
I would usually create a POST request. With todays CSS and CSS
frameworks styling a form button like a link and vice versa is a piece
of cake so people won't notice anyway and from a technical perspective a
POST is much preferred. Not only for Flow but also think url cache of
browsers. You shouldn't have a delete URL in the cache, doesn't feel good.
>
> Best regards,
>
> Felix
Cheers,
Christian
>
>
>> The thing is, that the persistence wont be triggered during GET requests.
>>
>> You need to inject the persistance manager and call persistAll to perist
>> you data in a GET request.
>>
>> Here a piece from the Flow Documentation:
>>
>>
>> Safe request methods are read-only
>>
>> According to the HTTP 1.1 specification, so called "safe request
>> methods" (usually GET or HEAD requests) should not change your data on
>> the server side and should be considered read-only. If you need to add,
>> modify or remove data, you should use the respective request methods
>> (POST, PUT, DELETE and PATCH).
>>
>> Flow supports this principle because it helps making your application
>> more secure and perform better. In practice that means for any Flow
>> application: if the current request is a "safe request method", the
>> persistence framework will NOT trigger persistAll() at the end of the
>> script run.
>>
>> If you need to store some data during a safe request (for example,
>> logging some data for your analytics), you are still free to call
>> PersistenceManager->persistAll() manually.
More information about the Flow
mailing list