TCA -> MM Setup funktioniert nicht

  • MajPay MajPay
    Jedi-Meister
    0 x
    345 Beiträge
    2 Hilfreiche Beiträge
    03. 09. 2012, 15:48

    Hallo,

    in meiner Lernextension habe ich ein Szenario, welches ich gerne mit einer N:M Tabelle gelöst hätte, ich habe eine Tabelle tx_testcompany_domain_model_employee und eine tx_testcompany_domain_model_function.

    Nun sollen den Employees beliebig viele functions zugewiesen werden können, das würde ich gerne wie beschrieben lösen.

    meine Tabellenstruktur:

    1. CREATE TABLE tx_testcompany_domain_model_employee (
    2. uid INT(11) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT,
    3. pid INT(11) DEFAULT '0' NOT NULL,
    4.  
    5. firstname VARCHAR(255) DEFAULT '' NOT NULL,
    6. surname VARCHAR(255) DEFAULT '' NOT NULL,
    7. title VARCHAR(255) DEFAULT '' NOT NULL,
    8. birthday INT(11) UNSIGNED DEFAULT '0' NOT NULL,
    9. location INT(11) DEFAULT '0' NOT NULL,
    10. company INT(11) DEFAULT '0' NOT NULL,
    11.  
    12. tstamp INT(11) UNSIGNED DEFAULT '0' NOT NULL,
    13. crdate INT(11) UNSIGNED DEFAULT '0' NOT NULL,
    14. deleted tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
    15. hidden tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
    16.  
    17. PRIMARY KEY (uid),
    18. KEY parent (pid)
    19. );

    1. CREATE TABLE tx_testcompany_domain_model_function (
    2. uid INT(11) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT,
    3. pid INT(11) DEFAULT '0' NOT NULL,
    4.  
    5. name VARCHAR(255) DEFAULT '' NOT NULL,
    6. description VARCHAR(255) DEFAULT '' NOT NULL,
    7.  
    8. tstamp INT(11) UNSIGNED DEFAULT '0' NOT NULL,
    9. crdate INT(11) UNSIGNED DEFAULT '0' NOT NULL,
    10. deleted tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
    11. hidden tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
    12.  
    13. PRIMARY KEY (uid),
    14. KEY parent (pid)
    15. );

    1. CREATE TABLE tx_testcompany_employee_function_mm (
    2. uid_local INT(10) UNSIGNED DEFAULT '0' NOT NULL,
    3. uid_foreign INT(10) UNSIGNED DEFAULT '0' NOT NULL,
    4. sorting INT(10) UNSIGNED DEFAULT '0' NOT NULL,
    5. sorting_foreign INT(10) UNSIGNED DEFAULT '0' NOT NULL,
    6.  
    7. KEY uid_local (uid_local),
    8. KEY uid_foreign (uid_foreign)
    9. );

    Die ext_tables.php

    1. $TCA['tx_testcompany_domain_model_employee'] = array (
    2. 'ctrl' => array (
    3. 'title' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_employee.ext_title',
    4. 'label' => 'surname',
    5. 'tstamp' => 'tstamp',
    6. 'crdate' => 'crdate',
    7. 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php',
    8. 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'
    9. )
    10. );

    1. $TCA['tx_testcompany_domain_model_function'] = array (
    2. 'ctrl' => array (
    3. 'title' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_function.title',
    4. 'label' => 'name',
    5. 'tstamp' => 'tstamp',
    6. 'crdate' => 'crdate',
    7. 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/tca.php',
    8. 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'
    9. )
    10. );

    Und meine tca.php

    1. $TCA['tx_testcompany_domain_model_employee'] = array(
    2. 'ctrl' => $TCA['tx_testcompany_domain_model_employee']['ctrl'],
    3. 'types' => array(
    4. '1' => array('showitem' => 'hidden, title, firstname, surname, birthday, company, location')
    5. ),
    6. 'palettes' => array(
    7. '1' => array('showitem' => '')
    8. ),
    9. 'columns' => array(
    10. 'hidden' => array(
    11. 'exclude' => 0,
    12. 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
    13. 'config' => array(
    14. 'type' => 'check'
    15. )
    16. ),
    17. 'firstname' => array(
    18. 'exclude' => 0,
    19. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_employee.firstname',
    20. 'config' => array(
    21. 'type' => 'input',
    22. 'size' => 20,
    23. 'eval' => 'trim, required',
    24. 'max' => 256
    25. )
    26. ),
    27. 'surname' => array(
    28. 'exclude' => 0,
    29. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_employee.surname',
    30. 'config' => array(
    31. 'type' => 'input',
    32. 'size' => 20,
    33. 'eval' => 'trim, required',
    34. 'max' => 256
    35. )
    36. ),
    37. 'title' => array(
    38. 'exclude' => 0,
    39. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_employee.title',
    40. 'config' => array(
    41. 'type' => 'input',
    42. 'size' => 20,
    43. 'eval' => 'trim, required',
    44. 'max' => 50
    45. )
    46. ),
    47. 'birthday' => array(
    48. 'exclude' => 0,
    49. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_employee.birthday',
    50. 'config' => array(
    51. 'type' => 'input',
    52. 'size' => 12,
    53. 'eval' => 'datetime, required',
    54. 'default' => time()
    55. )
    56. ),
    57. 'company' => array(
    58. 'exclude' => 0,
    59. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_company.title',
    60. 'config' => array (
    61. 'type' => 'select',
    62. 'foreign_table' => 'tx_testcompany_domain_model_company',
    63. 'maxitems' => 1,
    64. )
    65. ),
    66. 'location' => array(
    67. 'exclude' => 0,
    68. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_location.title',
    69. 'config' => array (
    70. 'type' => 'select',
    71. 'foreign_table' => 'tx_testcompany_domain_model_location',
    72. 'maxitems' => 1,
    73. )
    74. ),
    75. 'functions' => array(
    76. 'exclude' => 1,
    77. 'label' => 'LLL:EXT:test_company/Resources/Private/Language/locallang_db.xml:tx_testcompany_domain_model_function.title',
    78. 'config' => array (
    79. 'type' => 'inline',
    80. 'foreign_table' => 'tx_testcompany_domain_model_function',
    81. 'MM' => 'tx_testcompany_employee_function_mm',
    82. 'maxitems' => 9999,
    83. 'minitems' => 0,
    84. 'multiple' => 1,
    85. 'autoSizeMax' => 30,
    86. 'appearance' => array(
    87. 'useCombination' => 1,
    88. 'useSortable' => 1,
    89. 'collapseAll' => 1,
    90. 'axpandSingle' => 1
    91. )
    92. )
    93. )
    94. )
    95. );

    Ich bekomme von Typo3 folgenden Fehler (wenn ich zb einen employee bearbeite und functions aus der Liste auswähle):

    1. #1247602160: Unknown column 'functions' in 'field list': UPDATE tx_testcompany_domain_model_employee SET company='16', firstname='Max', surname='Paul', title='Dr.', birthday='29.3.1988', location='7', functions='3', tstamp='1346679336' WHERE uid='7' (More information)

    Extbase/Typo3 will mir also die functions direkt in den employee datensatz schreiben statt mir die Beziehungen in der MM Tabelle anzulegen.

    Was habe ich vergessen?

    In Controller, DomainObjects und Templates sollte kein Fehler sein denke ich.


  • 1
  • LuP LuP
    Jedi-Meister
    0 x
    496 Beiträge
    1 Hilfreiche Beiträge
    03. 09. 2012, 16:18

    Hallo,

    functions fehlt in der employee SQL-Tabelle.

    VG,
    LuP

  • MajPay MajPay
    Jedi-Meister
    0 x
    345 Beiträge
    2 Hilfreiche Beiträge
    03. 09. 2012, 16:34

    Oh man danke!!

    Da hätte ich ja ewig suchen können. Wirklich nötig ist das Feld ja nicht oder?

  • 1