sqli / ezplatform_adminui_extended
该软件包已被弃用且不再维护。作者建议使用sqli/eztoolbox软件包。
SQLI eZPlatform AdminUI Extended是一个扩展包,可以在管理顶部工具栏中添加一个新标签页,并允许显示和CRUD实体。
v0.4
2020-01-02 17:14 UTC
Requires
- php: ^7.1
- doctrine/doctrine-bundle: ^1.6
- doctrine/orm: ^2.5
- ezsystems/ezplatform-admin-ui: ^1.0
- ezsystems/ezpublish-kernel: ^7.0
- symfony/symfony: ^3.4.2
- twig/twig: ^1.0||^2.0
- white-october/pagerfanta-bundle: ^1.1
This package is auto-updated.
Last update: 2023-11-03 18:47:18 UTC
README
SQLI eZPlatform AdminUI Extended是一个扩展包,可以在管理顶部工具栏中添加一个新标签页,并允许显示和CRUD实体。
安装
使用composer安装
composer require sqli/ezplatform_adminui_extended:dev-master
注册扩展包
在app/AppKernel.php中激活扩展包
// app/AppKernel.php public function registerBundles() { $bundles = [ // ... new SQLI\EzPlatformAdminUiExtendedBundle\SQLIEzPlatformAdminUiExtendedBundle(), ]; }
添加路由
在app/config/routing.yml
# SQLI Admin routes _sqli_admin: resource: "@SQLIEzPlatformAdminUiExtendedBundle/Resources/config/routing.yml" prefix: /
资产
生成资产
php bin/console assetic:dump php bin/console cache:clear
参数
配置目录(如果不符合PSR-0规则,则配置命名空间)以查找实体
sqli_ez_platform_admin_ui_extended: entities: - { directory: 'Acme/AcmeBundle/Entity/Doctrine' } - { directory: 'Acme/AcmeBundle2/Entity/Doctrine', namespace: 'Acme\AcmeBundle2NoPSR0\ORM\Doctrine' }
如果您的类命名空间遵循PSR-0规则,请使用"~",或者指定包含它们的目录。
(可选)更改标签页名称
您可以使用此翻译键来更改默认标签页的标签,领域为sqli_admin:sqli_admin__menu_entities_tab__default
实体上的注解
<?php namespace Acme\AcmeBundle\Entity\Doctrine; use SQLI\EzPlatformAdminUiExtendedBundle\Annotations\Annotation as SQLIAdmin; /** * Class MyEntity * * @package Acme\AcmeBundle\Entity\Doctrine * @ORM\Table(name="my_entity") * @ORM\Entity(repositoryClass="Acme\AcmeBundle\Repository\Doctrine\MyEntityRepository") * @SQLIAdmin\Entity(update=true, * create=true, * delete=false, * csv_exportable=false, * max_per_page=5, * tabname="other_tab" * description="Describe your entity") */ class MyEntity { /** * @var int * * @ORM\Column(name="id",type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="data",type="string") * @SQLIAdmin\EntityProperty(visible=false) */ private $data; /** * @var string * * @ORM\Column(name="text",type="string") * @SQLIAdmin\EntityProperty(description="Describe property of your entity",readonly=true) */ private $text; /** * @var string * @ORM\Column(name="select",type="int") * @SQLIAdmin\EntityProperty(choices={"First choice": 1, "Second choice": 2}) */ private $select; /** * @var integer * @ORM\Column(name="content_id",type="int") * @SQLIAdmin\EntityProperty(extra_link="location") */ private $contentID; // ... public function getId() { return $this->id; } public function getData() : ?string { return $this->data; } public function getText() : string { return $this->text ?: ''; } public function getSelect() : int { return $this->select; } public function getContentID(): int { return $this->contentID; } }
类注解Entity有以下属性
- description 描述
- update 允许更新表中的行
- delete 允许删除表中的行
- create 允许在表中创建新行
- max_per_page 每页元素数量(Pagerfanta)
- csv_exportable 允许对实体进行CSV导出
- tabname 将此实体分组在顶部菜单下的标签页中,而不是默认标签页
属性注解EntityProperty有以下属性
- description 描述
- visible 显示列
- readonly 在编辑表单中不允许修改
- choices 将散列传递到ChoiceType
- extra_link 使用值作为contentID或locationID或tagID(必需Netgen/TagsBundle)在eZPlatform Back-Office中创建链接
支持类型
支持的Doctrine类型列表
注意:如果您选择在getters上指定返回类型,请小心:在创建模式下,getters将返回'null',因此请提供默认值或使返回类型为null(请参见上面类示例中的getter)。
标签页
为实体指定类注解tabname将在主顶部菜单下创建一个新的标签页。
此标签的标签可以在翻译领域sqli_admin中使用此键定义
sqli_admin__menu_entities_tab__tabname
默认标签的翻译
sqli_admin__menu_entities_tab__default: "Doctrine实体"