Extbase tablename mapping with namespaces

Recently I’m working alot with TYPO3 6.0, Extbase, Fluid and Twitter Bootstrap. I really like them in this combination and hope to write more about these subjects on this...

Recently I’m working alot with TYPO3 6.0, Extbase, Fluid and Twitter Bootstrap. I really like them in this combination and hope to write more about these subjects on this blog. However today i wanted to write a short memo here on how you should map your namespaced Extbase domain models to existing tables. Because mapping regular domain models (not namespaced) was easy it was something like this:

 

     config.tx_extbase.persistence.classes {
	Tx_MyExtension_Domain_Model_User {
		 mapping {
                     tableName = fe_users
                     columns {
                           first_name.mapOnProperty = firstName
                           name.mapOnProperty = name
                     }
                 }
        }
     }

Now with TYPO3 6.0 namespaces were introduced and your domain model uses them, in this case your mapping should look like this:

     config.tx_extbase.persistence.classes {
	Vendor/MyExtension/Domain/Model/User {
		 mapping {
                     tableName = fe_users
                     columns {
                           first_name.mapOnProperty = firstName
                           name.mapOnProperty = name
                     }
                 }
        }
     }

Be careful and write it in this form: Vendor/MyExtension/Domain/Model/User do not put a slash (/) before the Vendor because it won’t work. I wasted enough time figuring this out :) Of course probably i don’t have to mention that this typoscript above goes into the Configuration/Typoscript/setup.txt file of your extension

No Comments

Leave a Reply

*

*