类扩展SonataPagePage列未找到

问题描述

我刚安装了Sonata Page-Bundle,并想创建另一种页面类型。 现在有默认的内容类型:网站,页面,块等。我想创建一个实体Article,该实体扩展了SonataPagePage,其中包含相同的字段,但我可以在article类中设置其他字段。

我创建了本文实体,并将其所有继承的属性持久保存到数据库中。

class Article extends SonataPagePage

这似乎可行,但是,当我在SonataAdmin中注册该类时,我收到一条错误消息,指出未找到列:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT p0_.route_name AS route_name_0,p0_.page_alias AS page_alias_1,p0_.type AS type_2,p0_.position AS position_3,p0_.enabled AS enabled_4,p0_.decorate AS decorate_5,p0_.edited AS edited_6,p0_.name AS name_7,p0_.slug AS slug_8,p0_.url AS url_9,p0_.custom_url AS custom_url_10,p0_.request_method AS request_method_11,p0_.title AS title_12,p0_.meta_keyword AS meta_keyword_13,p0_.meta_description AS meta_description_14,p0_.javascript AS javascript_15,p0_.stylesheet AS stylesheet_16,p0_.raw_headers AS raw_headers_17,p0_.template AS template_18,p0_.created_at AS created_at_19,p0_.updated_at AS updated_at_20,p0_.id AS id_21,p0_.site_id AS site_id_22,p0_.parent_id AS parent_id_23,p0_.target_id AS target_id_24 FROM article a1_ ORDER BY a1_.id ASC':
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'p0_.route_name' in 'field list'").

我似乎找不到关于此的任何文档。奏鸣曲文档或stackoverflow。 如何创建此实体?

<?php

namespace App\Entity;

use App\Repository\ArticleRepository;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass=ArticleRepository::class)
 */
class Article extends SonataPagePage
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    protected $id;

    public function getId(): ?int
    {
        return $this->id;
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...