[TYPO3-mvc] Define a PID per object, not by configuration
Adrien Crivelli
adrien.crivelli at gmail.com
Tue Aug 9 03:37:37 CEST 2011
Hello list,
I'v struggled for a few days with PID storage. I am at the point where I
need advice before doing some very ugly things.
I need to read and create objects on many several PIDs. For a while I manage
reading what I needed by extending Tx_Extbase_Persistence_Repository with:
abstract class My_AbstractRepository
{
public function createQuery()
{
$query = parent::createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
return $query;
}
}
Now I need to create object and it is not as simple as that. According to
the latest documentation <http://forge.typo3.org/issues/3698#note-15> I
found, PID are set by configuration. In several ways, but always
configuration. That means PIDs are kind of static data. It doesn't fit my
needs as I usually want to store object on the current page (as my project
is a BE extension using ExtJs, "current page" isn't necessarily so
straightforward).
Of course I tried things like:
$newNewsletter->setPid(12345);
$this->newsletterRepository->add($newNewsletter);
But, as many before me, it wasn't long before I figured out that the PID is
always overwritten by the configuration
(via Tx_Extbase_Persistence_Backend::determineStoragePageIdForNewRecord()).
So the first question is simple: Why can't we manually set a PID without
being overwritten ?
Cheers,
More information about the TYPO3-project-typo3v4mvc
mailing list