“Map to existing tables” in Extension builder showing weird issues in TYPO3

怎甘沉沦 提交于 2019-12-06 02:55:31

问题


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:

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

  • My Page Edit becomes like this:

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 {

}

回答1:


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.



来源:https://stackoverflow.com/questions/17962619/map-to-existing-tables-in-extension-builder-showing-weird-issues-in-typo3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!