Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Map to existing tables" in Extension builder showing weird issues in TYPO3

Tags:

php

typo3

extbase

In my extension MyExt, I mapped the model Page to pages table in TYPO3. Firstly it shows me the type mismatch error, I anyhow went ahead and saved it.

The following things happen:

  • My Page tree becomes like this:

enter image description here

  • My New Record Form shows only the UIDs and not the titles:

enter image description here

  • My Page Edit becomes like this: enter image description here

In my MyExt/Configuration/TypoScript/setup.txt I have this:

config.tx_extbase.persistence.classes {
    Tx_MyExt_Domain_Model_Page {
        mapping {
            tableName = pages
        }
    }
}

Is this a bug ? Or something i'm doing wrong ?

This is my /Domain/Model/Page.php , just a glimpse of it.

class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{

    /**
     * uid
     * @var int
     * @validate NotEmpty
     */
    protected $uid;

    /**
     * title
     * @var string
     * @validate NotEmpty
     */
    protected $title;

    /**
     * __construct
     *
     * @return Page
     */
    public function __construct() {
        //Do not remove the next line: It would break the functionality
        $this->initStorageObjects();
    }

   /**
    * Returns the title
    *
    * @return string $title
   */
  public function getTitle(){
    return $this->title;
  }

}

My /Domain/Repository/PageRepository.php is

class PageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {

}
like image 660
dora Avatar asked Oct 04 '22 09:10

dora


1 Answers

Just delete the whole $TCA['pages'] section from the file my_ext/ext_tables.php, or comment it out.

If set, it overrides most default TCA settings from the TYPO3 core with values from your extension. You probably don't need custom settings for that.

like image 55
Mateng Avatar answered Oct 07 '22 23:10

Mateng