[TYPO3-mvc] How to assign target pidforTx_Extbase_Persistence_Repository::add

Nikolas Hagelstein hagelstein at shr.cc
Thu Jun 18 12:22:15 CEST 2009


Hi,

Changing:

Classes/Persistence/Mapper/ObjectRelationalMapper.php
635: if ($dataMap->hasPidColumn()) {

To 
Classes/Persistence/Mapper/ObjectRelationalMapper.php
635: if ($dataMap->hasPidColumn() && !$row['pid']) {

Hands over pid control back to the application but obviously slightly violates the design paradigm.
Perhaps it's worth to reconsinder the autopoluation of systemfields.

For the pid it might make sense to introduce something like a fallback chain.
1. Set by the object instance itself (manually set by the application).
2. Plugin configuration
3. TSFE:id

What do you think?

Cheers,
Nikolas


-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.netfielders.de [mailto:typo3-project-typo3v4mvc-bounces at lists.netfielders.de] Im Auftrag von Nikolas Hagelstein
Gesendet: Donnerstag, 18. Juni 2009 12:03
An: TYPO3 v4 MVC project
Betreff: Re: [TYPO3-mvc] How to assign target pidforTx_Extbase_Persistence_Repository::add

Hi,

hmm i just played arround a little.
Am I right saying, that atm there is no way to assign a pid manually?.
I tried to set the pid property of my object within the controller right
before "add". But it  gets overwritten with
TSFE:id.

A short grep pid over extbase unearth the following:

---
Classes/Persistence/Mapper/ObjectRelationalMapper.php
635: if ($dataMap->hasPidColumn()) {
636:   // TODO  Should we merge the settings from $this->cObj into the
extension settings (in the dispatcher)
637:   $row['pid'] = !empty($this->cObj->data['pages']) ?
$this->cObj->data['pages'] : $GLOBALS['TSFE']->id;
638: }

Classes/Persistence/Mapper/DataMap.php:
306: public function hasPidColumn() {
307:  // TODO Should we implement a check for having a pid column?
308:   return TRUE;
309: }


Classes/Persistence/Mapper/DataMap.php
144: protected function addCommonColumns() {
145: // TODO Decide whether we should add pid and uid columns by default
146:  $this->addColumn('uid',
Tx_Extbase_Persistence_Mapper_ColumnMap::TYPE_INTEGER);
147:  $this->addColumn('pid',
Tx_Extbase_Persistence_Mapper_ColumnMap::TYPE_INTEGER);
---
Hmmm cObj of the OjectRelationalMapper isn set hasPidColumn returns true
by default ...dead end right? ;).

Cheers,
Nikolas

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list