MetaModels Workshop in Berlin
Ergebnis 1 bis 7 von 7

Thema: There is no column with name 'id' on table ...

  1. #1
    Contao-Nutzer
    Registriert seit
    12.04.2011.
    Ort
    München
    Beiträge
    43

    Frage There is no column with name 'id' on table ...

    Hallo zusammen,

    nach einem Update einer 3.5 Installation auf die neueste Contao-Version 4 gibt es ein Problem mit dem Aufruf des Install-Tools, sobald ich eine eigens entwickelte Erweiterung ins Modules Verzeichnis kopiere und den Cache leere.

    Code:
    There is no column with name 'id' on table ...
    In der besagten Table existiert aber eine Spalte 'id' als Primary-Key?

    Hat irgendjemand eine Idee?

    Vielen Dank!

  2. #2
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Vienna, Austria
    Beiträge
    20.573
    User beschenken
    Wunschliste

    Standard

    Poste die gesamte Fehlermeldung und das DCA der Tabelle.

  3. #3
    Contao-Nutzer
    Registriert seit
    12.04.2011.
    Ort
    München
    Beiträge
    43

    Standard

    Fehlermeldung:

    Code:
    [2019-06-17 11:44:00] request.INFO: Matched route "contao_install". {"route":"contao_install","route_parameters":{"_route":"contao_install","_scope":"backend","_token_check":true,"_controller":"Contao\\InstallationBundle\\Controller\\InstallationController::installAction"},"request_uri":"http://***.local:8889/contao/install","method":"HEAD"} []
    [2019-06-17 11:44:00] request.INFO: Matched route "contao_install". {"route":"contao_install","route_parameters":{"_route":"contao_install","_scope":"backend","_token_check":true,"_controller":"Contao\\InstallationBundle\\Controller\\InstallationController::installAction"},"request_uri":"http://***.local:8889/contao/install","method":"GET"} []
    [2019-06-17 11:44:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Schema\SchemaException: "There is no column with name 'id' on table 'tl_cars'." at /Users/fl0rian/code/websites/***/***/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php line 89 {"exception":"[object] (Doctrine\\DBAL\\Schema\\SchemaException(code: 30): There is no column with name 'id' on table 'tl_cars'. at /Users/fl0rian/code/websites/***/***/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php:89)"} []
    DCA:

    Code:
    <?php
    
    
    /**
     * Table tl_cars
     */
    $GLOBALS['TL_DCA']['tl_cars'] = array
    (
    
    // Config
    	'config'   => array
    	(
    		'dataContainer'    => 'Table',
    		'enableVersioning' => true,
    		'sql'              => array
    		(
    			'keys' => array
    			(
    				'id' => 'primary'
    			)
    		),
    	),
    
    // List
    	'list'     => array
    	(
    		'sorting' => array
    		(
    			'mode'        => 2,
    			'fields'      => array('title'),
    			'flag'        => 2,
    			'panelLayout' => 'filter;sort,search,limit'
    		),
    
    		'label'             => array
    		(
    			'fields' => array('title'),
    			'format' => '<span style="padding-left:25px;">%s</span>',
    		),
    
    // Global
    	'global_operations' => array
    		(
    			'all' => array
    			(
    				'label'      => &$GLOBALS['TL_LANG']['MSC']['all'],
    				'href'       => 'act=select',
    				'class'      => 'header_edit_all',
    				'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"'
    			)
    		),
    
    // Operations
    	'operations'        => array
    		(
    			'edit'   => array
    			(
    				'label' => &$GLOBALS['TL_LANG']['tl_cars']['edit'],
    				'href'  => 'act=edit',
    				'icon'  => 'edit.gif'
    			),
    			'copy' => array
                (
                    'label' => &$GLOBALS['TL_LANG']['tl_cars']['copy'],
                    'href' => 'act=copy',
                    'icon' => 'copy.gif'
                ),
    			'delete' => array
    			(
    				'label'      => &$GLOBALS['TL_LANG']['tl_cars']['delete'],
    				'href'       => 'act=delete',
    				'icon'       => 'delete.gif',
    				'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'
    			),
    			'show'   => array
    			(
    				'label'      => &$GLOBALS['TL_LANG']['tl_cars']['show'],
    				'href'       => 'act=show',
    				'icon'       => 'show.gif',
    				'attributes' => 'style="margin-right:3px"'
    			),
    		)
    	),
    
    'palettes' => array
        (
            'default' => '
    		{common_legend},title,alias,type,brand,emob,date;
    		{autor_legend},autor,autor2;
    		{content_legend},text,e_description,info,design,engine,electronic,driving,specials,result;
    		{size_legend},tech_size_length,tech_size_width,tech_size_height,tech_weight;
    		{technique_legend},tech_engine,tech_power,tech_torsional,tech_gear,tech_trunk,tech_speed_top,tech_speed_acceleration,tech_towing_capacity,tech_towing_capacity_unbraked;
    		{consumption_legend},tech_tank_capacity,tech_test_consumption,tech_manuf_consumption,tech_co2,tech_emission_class;
    		{price_legend},price_basic,price_test;
    		{rating_legend},text_pos,text_neg;
    		{media_legend},text_teaser,teaser_image,image1,text_image1,image2,text_image2,image3,text_image3,image4,text_image4,gallery;
    		{video_legend},video_youtube;
    		{misc_legend},published,show_in_slider'
        ),
        'fields'   => array
        (
            'title'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['title'],
                'inputType' => 'text',
                'search'    => true,
                'eval'      => array(
                    'mandatory' => true,
                    'maxlength' => 255,
                    'doNotCopy' => true,
                    'tl_class' => 'w50'
                )
            ),
            'alias'            => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['alias'],
                'inputType' => 'text',
                'eval'      => array(
                    'mandatory' => true,
                    'rgxp'       => 'alias',
                    'maxlength' => 255,
                    'doNotCopy' => true,
                    'tl_class' => 'w50'
                )
            ),
            'type'                          => array
    			(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_cars']['type'],
    			'inputType'               => 'select',
    			'foreignKey'              => 'tl_cars_types.title',
    			'search'                  => true,
    			'sorting'                 => true,
    			'eval'                    => array('mandatory'=>true, 'tl_class' => 'w50')
            ),
            'brand'                          => array
    			(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_cars']['brand'],
    			'inputType'               => 'select',
    			'foreignKey'              => 'tl_cars_brands.title',
    			'search'                  => true,
    			'sorting'                 => true,
    			'eval'                    => array('mandatory'=>true, 'tl_class' => 'w50')
            ),
            'autor'                          => array
    			(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_cars']['autor'],
    			'inputType'               => 'select',
    			'foreignKey'              => 'tl_cars_team.matchcode',
    			'search'                  => true,
    			'sorting'                 => true,
    			'eval'                    => array('mandatory'=>true, 'tl_class' => 'w50', 'includeBlankOption' => true)
            ),
            'autor2'                          => array
    			(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_cars']['autor2'],
    			'inputType'               => 'select',
    			'foreignKey'              => 'tl_cars_team.matchcode',
    			'search'                  => true,
    			'sorting'                 => true,
    			'eval'                    => array('mandatory'=>false, 'tl_class' => 'w50', 'includeBlankOption' => true)
            ),
            'date'                          => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['date'],
                'inputType' => 'text',
                'eval'      => array(
                    'mandatory' => true,
                    'doNotCopy' => true,
                    'datepicker' => true,
                    'tl_class' => 'wizard w50'
                )
            ),
            'e_description'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['e_description'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'text'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => true,)
            ),
            'info'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['info'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'design'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['design'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'engine'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['engine'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'electronic'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['electronic'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'driving'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['driving'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'specials'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['specials'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'result'                          => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['result'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE', 'mandatory' => false,)
            ),
            'text_pos'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_pos'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE')
            ),
            'text_neg'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_neg'],
                'inputType' => 'textarea',
                'eval'      => array('rte' => 'tinyMCE')
            ),
            'tech_engine'                   => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_engine'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_power'                    => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_power'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_torsional'                => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_torsional'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_gear'                     => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_gear'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_size_width'               => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_size_width'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_size_length'              => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_size_length'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_size_height'              => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_size_height'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_weight'                   => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_weight'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_towing_capacity'          => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_towing_capacity'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_towing_capacity_unbraked' => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_towing_capacity_unbraked'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_trunk'                    => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_trunk'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_speed_acceleration'       => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_speed_acceleration'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_speed_top'                => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_speed_top'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_tank_capacity'            => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_tank_capacity'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_test_consumption'         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_test_consumption'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_manuf_consumption'        => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_manuf_consumption'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_co2'                      => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_co2'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'tech_emission_class'           => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['tech_emission_class'],
                'inputType' => 'text',
                'eval'      => array('maxlength' => 255, 'tl_class' => 'w50')
            ),
            'price_basic'                   => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['price_basic'],
                'inputType' => 'text',
                'eval'      => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50')
            ),
            'price_test'                    => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['price_test'],
                'inputType' => 'text',
                'eval'      => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50')
            ),
    		'gallery' => array
    			(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_module']['gallery'],
    			'exclude'                 => true,
    			'inputType'               => 'fileTree',
    			'eval'                    => array('multiple'=>true, 'fieldType'=>'checkbox', 'orderField'=>'orderSRC', 'files'=>true, 'mandatory'=>false),
    			'sql'                     => "blob NULL"
    			),
    		'orderPages' => array
    		(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_module']['orderSRC'],
    			'sql'                     => "blob NULL"
    		),
            'image1'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['image1'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio'
                )
               // 'default'   => array('files/website/images/cars/default.jpg') // Nicht existent!
            ),
            'image2'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['image2'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio'
                ),
                // 'default'   => array('files/website/images/cars/default.jpg') // Nicht existent!
            ),
            'image3'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['image3'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio'
                ),
               // 'default'   => array('files/website/images/cars/default.jpg') // Nicht existent!
            ),
            'image4'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['image4'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio'
                ),
                // 'default'   => array('files/website/images/cars/default.jpg') // Nicht existent!
            ),
            'text_image1' => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_image1'],
                'inputType' => 'text',
                'eval' => array(
                    'maxLength' => 255
                )
            ),
            'text_image2'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_image2'],
                'inputType' => 'text',
                'eval' => array(
                    'maxLength' => 255
                )
            ),
            'text_image3'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_image3'],
                'inputType' => 'text',
                'eval' => array(
                    'maxLength' => 255
                )
            ),
            'text_image4'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_image4'],
                'inputType' => 'text',
                'eval' => array(
                    'maxLength' => 255
                )
            ),
    		'teaser_image' => array
    			(
    				'label'     => &$GLOBALS['TL_LANG']['tl_cars']['teaser_image'],
    				'exclude'   => true,
    				'inputType' => 'fileTree',
    				'eval'      => array('filesOnly'=>true, 'fieldType'=>'radio'),
    				'sql'       => "binary(16) NULL"
    			),
    		'images' => array
    			(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_module']['images'],
    			'exclude'                 => true,
    			'inputType'               => 'fileTree',
    			'eval'                    => array('multiple'=>true, 'fieldType'=>'checkbox', 'orderField'=>'orderSRC', 'files'=>true, 'mandatory'=>false),
    			'sql'                     => "blob NULL"
    			),
    		'orderPages' => array
    		(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_module']['orderSRC'],
    			'sql'                     => "blob NULL"
    		),
            'emob'                     => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['emob'],
                'inputType' => 'checkbox',
                'default'   => true,
    			'eval'      => array('tl_class' => 'm12 w50')
    
            ),
            'published'                     => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['published'],
                'inputType' => 'checkbox',
                'default'   => true
            ),
            'show_in_slider'                     => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['show_in_slider'],
                'inputType' => 'checkbox',
                'default'   => false
            ),
            'text_teaser'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['text_teaser'],
                'inputType' => 'textarea',
                'eval'      => array()
            ),
            'video_image'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['video_image'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio',
                    'extensions' => 'jpeg, jpg, png'
                ),
            ),
            'video_mp4'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['video_mp4'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio',
                    'extensions' => 'mp4'
                ),
            ),
            'video_ogv'                         => array
            (
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['video_ogv'],
                'inputType' => 'fileTree',
                'eval'      => array(
                    'files'     => true,
                    'filesOnly' => true,
                    'mandatory' => false,
                    'fieldType' => 'radio',
                    'extensions' => 'ogv'
                ),
            ),
            'video_youtube'                      => array(
                'label'     => &$GLOBALS['TL_LANG']['tl_cars']['video_youtube'],
                'inputType' => 'text',
                'eval' => array(
                    'maxLength' => 255
                )
            ),
        ) );

  4. #4
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Vienna, Austria
    Beiträge
    20.573
    User beschenken
    Wunschliste

    Standard

    Dir fehlen in deinem DCA das "id" und "tstamp" Feld.

  5. #5
    Contao-Nutzer
    Registriert seit
    12.04.2011.
    Ort
    München
    Beiträge
    43

    Standard

    Ok, danke für die schnelle Antwort!

    Die Erweiterung ist nicht von mir.
    Dann beschäftige ich mich mal mit dem generellen Aufbau von DCAs.

    Hast du evtl. noch ein kurzes Codebeispiel, wie das id und tstamp Feld eingebunden werden?

    Code:
    // Config
    	'config'   => array
    	(
    		'dataContainer'    => 'Table',
    		'enableVersioning' => true,
    		'sql'              => array
    		(
    			'keys' => array
    			(
    				'id' => 'primary'
    			)
    		),
    	),
    Das reicht nicht? Zumindest für die id?

  6. #6
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Vienna, Austria
    Beiträge
    20.573
    User beschenken
    Wunschliste

    Standard

    Füge bei den "fields" einfach noch folgendes hinzu: https://github.com/contao/contao/blo....php#L152-L159

  7. #7
    Contao-Nutzer
    Registriert seit
    12.04.2011.
    Ort
    München
    Beiträge
    43

    Standard

    Danke für die schnelle Hilfe. Jetzt klappts!

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •