[TYPO3-mvc] Property / relation problem

Alexander Dick typo3 at dick.at
Fri Feb 3 10:58:07 CET 2012


Interesting.

I have to annotate the $country property as an integer rather than 
Tx_Xxx_Domain_Model_StaticCountry:

/**
  * @var integer
  */
protected $country;


getter and setter are Tx_Xxx_Domain_Model_StaticCountry

/**
  * @return Tx_Xxx_Domain_Model_StaticCountry
  */
public function getCountry() {
	return $this->country;
}


/**
  * @param Tx_Xxx_Domain_Model_StaticCountry $country
  * @return void
  */
public function setCountry($country) {
	$this->country = $country;
}


That way it works...
	

Am 03.02.2012 10:27, schrieb Alexander Dick:
> Hmmm, now that I am using UIDs there is another problem.
>
> when I submit the form with a selected country, I get the following error:
>
> Exception while property mapping at property path "user.country":Object
> with identity "54" not found.
>
> I did it exactly the same way like all my other relations, which are
> working.
>
> I found that when I set the country field in the database manually to
> "54", the error is gone - but only if I select the country with the ID
> 54. As soon as I select another one, the above error appears.
>
> What am I getting wrong here?!
>
> Thanks
> Alex
>
> Am 02.02.2012 18:19, schrieb Claus Due:
>> Hi Alex,
>>
>> Sounds like you could be running into a limitation in Extbase. After
>> checking, it appears that Extbase will not allow any other field to be
>> the UID - other than the field "uid". Perhaps this will help:
>>
>> http://forge.typo3.org/issues/25984
>>
>> ...although you would have to hack the Extbase core to do that and I'm
>> not sure if there are other adverse effects. There probably are.
>>
>> My recommendation: use the UID. The static info tables are... well..
>> static tables ;)
>>
>> --
>> Cheers,
>> Claus
>> http://fedext.net
>>
>> On Feb 2, 2012, at 5:25 PM, Alexander Dick wrote:
>>
>>> Well, if I add recordType, then my User object is empty.
>>>
>>> The field record_type does not exist in fe_users, but there is
>>> tx_extbase_type and it's populated with
>>> Tx_Extbase_Domain_Model_FrontendUser.
>>>
>>> What would the recordType be for?
>>>
>>> I also map static_countries:
>>>
>>> Tx_Xxx_Domain_Model_StaticCountry {
>>> mapping {
>>> tableName = static_countries
>>> }
>>> }
>>>
>>> The problem is supposedly that extbase does not know that I want to
>>> map the country property to the cn_iso_2 column of the
>>> static_countries table as I am not defining this anywhere since I
>>> dont have a TCA config for my User model.
>>>
>>> kind regards
>>> Alex
>>>
>>> Am 02.02.2012 17:09, schrieb Claus Due:
>>>>> PS: As soon as I add recordType it breaks completely.
>>>>
>>>> Define "breaks completely"? ;) any error messages to consider or
>>>> just a big black hole of nothing (empty page)?
>>>>
>>>> I assume the record type field is added to SQL/TCA OK? Unfortunately
>>>> I'm not really comfortable with the inner workings of the
>>>> object-to-table mapping in Extbase - but really, I would expect an
>>>> error message to be visible somewhere.
>>>>
>>>> Last question for this email :) do you have a mapping statement for
>>>> the static_info_country table that says "map to
>>>> Tx_Xxx_Domain_Model_StaticCountry"? This would also be required.
>>>>
>>>> --
>>>> Cheers,
>>>> Claus
>>>> http://fedext.net
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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