Search code examples
typo3typo3-6.2.x

TYPO3 How to extend existing extensions table definition


I am supposed to extend a TYPO3 Extension that a colleague wrote who is not working with us any longer.

Say we have a collection of animals, like dogs, cats, birds, snakes whatever. Now I need to add a new relation that specifies the animals family, like mammal, bird, reptile.

I figured I have to do the following:

  • Add a new class Family in Classes/Domain/Model/Family.php
  • Add the new relation to Classes/Domain/Model/Animal.php
  • Add the new fields to ext_typoscript_setup.txt
  • Add a number of lines to ext_tables.php

Unfortunately, the table is not created in the database and does not appear in the backend. Can anyone please hint me to what I am missing? (If you believe I did something wrong, I am willing to share my code, right now I have the feeling there is just a step missing - like initializing the new data et.al.)

Thanks in advance.


Solution

  • I was missing a significant step:

    In order to have the fields show up in the backoffice, one is required to add them to the TCA array and more specific to the interface sub-array like so:

    $GLOBALS['TCA']['tx_mytable']['interface']['showRecordFieldList'] .= ",newfield";
    $GLOBALS['TCA']['tx_mytable']['feInterface']['fe_admin_fieldList'] .= ", newfield";
    

    Hope this becomes useful to someone after all...