-->

Typo3 Error: The ColumnMap for property is missing

2019-08-20 10:16发布

问题:

I'm using Typo3 version 8.7.8 and I'm developing an extention. The two tables "auftrag" and "verstorbener" are connectet with a 1:n relation. I try to search for a field in the table "verstorbener" in the repository of "auftrag". The relation of both is necessary.

If I try to execute the following query I get the error "The ColumnMap for property "verstorbener" of class "...\Auftrag" is missing."

$name = "Mustermann";
		
$query->matching(
			$query->logicalAnd(
      $query->equals('verstorbener.nachname', $name)
			)
		);

How can I solve this problem? If you need more input feel free to ask for it.

Edit -- The relevant TCA code of the field "verst_id" in "auftrag" which contains the UID of "verstorbener":

    'verst_id' => [
        'exclude' => true,
        'label' => 'LLL:EXT:.../locallang_db.xlf:auftrag.verst_id',
        'config' => [
            'type' => 'inline',
            'foreign_table' => 'verstorbener',
            'foreign_field' => 'uid',
            'minitems' => 0,
            'maxitems' => 1,
            'appearance' => [
                'collapseAll' => 0,
                'levelLinksPosition' => 'top',
                'showSynchronizationLink' => 1,
                'showPossibleLocalizationRecords' => 1,
                'showAllLocalizationLink' => 1
            ],
        ],
    ],

Edit -- This is the object model

/**
 * verstId
 *
 * @var \...\Domain\Model\Verstorbener
 */
protected $verstId = null;

/**
 * Returns the verstId
 *
 * @return \...\Domain\Model\Verstorbener $verstId
 */
public function getVerstId()
{
    return $this->verstId;
}

/**
 * Sets the verstId
 *
 * @param \...\Domain\Model\Verstorbener $verstId
 * @return void
 */
public function setVerstId(\...\Domain\Model\Verstorbener $verstId)
{
    $this->verstId = $verstId;
}

回答1:

I've solved the problem. It seems like there layd some old data in the Typo3 cache. Clearing cache in the backend or in the installer doesn't helped. I had uninstall and reinstall the extension by hand.



回答2:

I encountered this issue when I was upgrading an Extension from Typo3 v6 to Typo3 v8. The mechanism for including TCA config files has changed, so the Files in /Configuration/TCA/ need to be named according to the extension name. For example: tx_extension_domain_model_auftrag.php The TCA configuration file only consists of a return array, no more $TCA['tx_extension_domain_model_auftrag']!

If you have TCA ctrl configuration in your ext_tables.php then combine this into the corresponding TCA files and remove the dynamicConfigFile definition!

Hope that helps :)