sqli / ezplatform_adminui_extended
SQLI eZPlatform AdminUI Extended is a bundle that add a new tab in admin top bar and allow to display and CRUD entities
Installs: 1 433
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 3
Type:ezplatform-bundle
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 is a bundle that add a new tab in admin top bar and allow to display and CRUD entities
Installation
Install with composer
composer require sqli/ezplatform_adminui_extended:dev-master
Register the bundle
Activate the bundle in app/AppKernel.php
// app/AppKernel.php public function registerBundles() { $bundles = [ // ... new SQLI\EzPlatformAdminUiExtendedBundle\SQLIEzPlatformAdminUiExtendedBundle(), ]; }
Add routes
In app/config/routing.yml
:
# SQLI Admin routes _sqli_admin: resource: "@SQLIEzPlatformAdminUiExtendedBundle/Resources/config/routing.yml" prefix: /
Assets
Generate assets :
php bin/console assetic:dump php bin/console cache:clear
Parameters
Configure directories (and namespaces if not according to PSR-0 rules) entities to lookup :
sqli_ez_platform_admin_ui_extended: entities: - { directory: 'Acme/AcmeBundle/Entity/Doctrine' } - { directory: 'Acme/AcmeBundle2/Entity/Doctrine', namespace: 'Acme\AcmeBundle2NoPSR0\ORM\Doctrine' }
Use "~" if the namespace of your classes observe PSR-0 rules or specify directory which contains them.
(Optional) Change label tabname
You can change label of the default tab using this translation key for domain sqli_admin
: sqli_admin__menu_entities_tab__default
Annotations on entities :
<?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; } }
Class annotation Entity
has following properties :
- description Description
- update Allow update of a line in table
- delete Allow deletion of a line in table
- create Allow creation of new line in table
- max_per_page Number of elements per page (Pagerfanta)
- csv_exportable Allow data CSV export for the entity
- tabname Group this entity in a tab under top menu instead of default tab
Property annotation EntityProperty
has following properties :
- description Description
- visible Display column
- readonly Disallow modifications in edit form
- choices An hash relayed to ChoiceType
- extra_link Use value as contentID or locationID or tagID (required Netgen/TagsBundle) to create a link in eZPlatform Back-Office
Supported types
List of supported Doctrine types :
- string
- text
- integer
- float
- decimal
- boolean
- date
- datetime
- array (Using serialization)
- object (Using serialization)
NOTICE : Be careful if you choose to specify the return type on getters : in creation mode, getters will return 'null' so please provide a default value or nullable in type of return (see getter in above class example)
Tab
Specifying class annotation tabname
for an entity will create a new tab under main top menu.
Label for this tab can be define in translation domain sqli_admin
with this key :
sqli_admin__menu_entities_tab__tabname
Traduction for default
tab :
sqli_admin__menu_entities_tab__default: "Entités Doctrine"