[TYPO3-mvc] Property / relation problem
Claus Due
claus at wildside.dk
Thu Feb 2 16:40:05 CET 2012
Hi Alex,
This is the same approach as when you want to map one of your custom Models to an existing table, fx fe_users:
config.tx_extbase.persistence.classes.Tx_Person_Domain_Model_Person.mapping {
tableName = fe_users
recordType = Tx_Person_Domain_Model_Person
}
This should work if you add this TS in a globally available template (and of course replace with your classnames/tables).
--
Cheers,
Claus
http://fedext.net
On Feb 2, 2012, at 4:24 PM, Alexander Dick wrote:
> Hi everyone!
>
> I am currently having a problem with a relation, I think the problem is that the property $country does contain the country code (DE, AT, CH, ...) rather than the UID of the foreign record.
>
> I chose the country code for consistency reasons - if you update the static_info_tables it may be that the UIDs change and I have wrong relations afterwards.
>
> Essentially the models look like this:
>
> class Tx_Xxx_Domain_Model_User extends Tx_Extbase_Domain_Model_FrontendUser {
>
> /**
> * Country with static info table code
> *
> * @var Tx_Xxx_Domain_Model_StaticCountry
> */
> protected $country;
>
> }
>
>
> class Tx_Xxx_Domain_Model_StaticCountry extends Tx_Extbase_DomainObject_AbstractEntity {
>
> /**
> * Country code
> *
> * @var string
> */
> protected $cnIso2;
>
> .
> .
> .
> }
>
>
> Now $user->getCountry() of course doesn't return anything because it searches 'DE' in the static_countries UID field instead of cn_iso_2 I suppose.
>
> How can I map it to cn_iso_2?
>
> I have played around in TS configuration with foo.mapOnProperty but no success so far.
>
> Also I don't have any TCA configuration for Tx_Xxx_Domain_Model_User (not needed because they are essentially fe_users records) where I could set a foreign_field.
>
> Thanks!
> Alex
> _______________________________________________
> 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