Sleek symfony admin boilerplate
Flex recipe incoming...
// config/bundles.php
return [
...
Suminagashi\OrchestraBundle\OrchestraBundle::class => ['all' => true],
];
// config/routes/orchestra.yaml
orchestra_admin:
resource: "@OrchestraBundle/Resources/config/routes.xml"
prefix: /admin
- Orchestra provide 2 new annotations :
@Resource
for class@Field
for properties
- The data validation use
Symfony\Component\Validator\Constraints
annotation
// src/Entity/Dummy.php
<?php
namespace App\Entity;
use Suminagashi\OrchestraBundle\Annotation\Resource;
use Suminagashi\OrchestraBundle\Annotation\Field;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Resource(
* name="Dummy"
* )
*/
class Dummy
{
/**
* @var string
* @ORM\Column(type="string")
* @Groups({"read", "write"})
* @Field(label="Test")
* @Assert\NotNull()
*/
private $test;
public function getTest(): ?string
{
return $this->test;
}
public function setTest(string $test): self
{
$this->test = $test;
return $this;
}
}
Attribute | Description |
---|---|
label |
Used to set the label displayed in the menu |
name |
Override default name of the resource |
actions |
WIP : Set available CRUD operations |