[TYPO3-mvc] Can't find floating objects

Frans van der Veen frans at netcreators.com
Mon Aug 24 23:14:52 CEST 2009


Hi Christoph,

I have had exactly the same problem.

My current workaround is calling
Tx_Extbase_Dispatcher::getPersistenceManager()->persistAll() to commit
the records to db.

Cheers,

Frans

Christoph Koehler wrote:
> Hello,
> 
> Scenario: Fetch an object from the db using findBy*, if none exists,
> create one. Repeat this several times.
> 
> Expected: The object isn't found the first iteration, is created and
> used. The next iteration will find the object that was created
> previously and use it instead of creating a new one.
> 
> Actual: The object isn't found the first iteration, is created and used.
> The next iteration does _NOT_ find the previously created object and
> create another new one with the same attributes as the first one. This
> will be done for each iteration until everything is saved to the db. The
> result is many objects that share attributes.
> 
> Fix: Either enable the find* methods to search objects that have not yet
> been committed to the db, or save objects more often to the db.
> 
> Workaround?: Is there a way to manually save all floating objects into
> the db? If so, how?
> 
> Thanks!
> 
> Christoph


More information about the TYPO3-project-typo3v4mvc mailing list