Skip to content

Latest commit

 

History

History
101 lines (75 loc) · 2.3 KB

README.md

File metadata and controls

101 lines (75 loc) · 2.3 KB

orchestra

Sleek symfony admin boilerplate

Build Version Total Download License

Install the bundle :

Flex recipe incoming...

Register the bundle :

// config/bundles.php

return [
    ...
    Suminagashi\OrchestraBundle\OrchestraBundle::class => ['all' => true],
];

Register the route :

// config/routes/orchestra.yaml

orchestra_admin:
  resource: "@OrchestraBundle/Resources/config/routes.xml"
  prefix: /admin

Usage :

  • Orchestra provide 2 new annotations :
    • @Resource for class
    • @Field for properties
  • The data validation use Symfony\Component\Validator\Constraints annotation

Examples :

// 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;
    }
}

API Reference

@Resource

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