[TYPO3-mvc] Unable to get pid of Domain Model Object

Alexander Dick alex at dick.at
Tue Oct 5 17:51:43 CEST 2010


Hi Christine, 

Thank you! 

I added the pid field to the TCA Array and set it to readOnly => true, now it works! 
I remember that I did this on another Object shortly but the found it too ugly to be true ;-) 

Why is that? I mean it is obvious that the pid Field should not be displayed in a TCEform as it is set automatically when you save a record. 
Seems like extbase relies a bit too much on that TCA array regarding this field! 

Anyway, for now it is acceptable having the field displayed since I can set it to readOnly so the customer cant'edit it anyway.

Cheers
Alex 


On Tue, 5 Oct 2010 18:24:48 +0300, Christine Gerpheide <cgerpheide at gmail.com> wrote:
> 2010/10/5 Alexander Dick <alex at dick.at>
> 
>>
>> Hi List,
>>
>> I am unable to get the pid of a record. In my Model there is the
> property
>> and the corresponding getter:
>>
>> /**
>>  * @var integer
>>  */
>> protected $pid;
>>
>> /**
>>  * @return integer
>>  */
>> public function getPid() {
>>    return $this->pid;
>> }
>>
>> but getPid returns always null - what's the problem there?
>> getUid works as expected.
>>
>> Thanks in advance
>> Alex
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>
> 
> 
> Hi Alex,
> 
> If you print_r the object (not using the getter), do you see the pid
> filled
> in at all?  If not: You could try adding a column in the TCA.  Also, I
> recall having a problem with getting the pid of Page objects from the
> pages
> table, and I ended up configuring it explicitly with persistence TS to be
> filled in (though I still don't understand why I had to do this):
> 
> classes {
> Tx_MyExt_Domain_Model_Page {
>  mapping {
> tableName = pages
> columns {
> pid.mapOnProperty = pid
>  }
> }
> }
> }
> 
> 
> Maybe that helps...
> Christine
> 
> -- 
> Christine Gerpheide   ? larissa, greece   @ www.pheide.com
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list