2017 © Pedro Peláez
 

symfony-bundle crud-bundle

Base controller for crud

image

xpat/crud-bundle

Base controller for crud

  • Monday, January 29, 2018
  • by xpat23
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

XPatCrudBundle

Installation

Use Composer for the automated process:, (*1)

 composer require xpat/crud-bundle

Adding bundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new XPat\CrudBundle\XPatCrudBundle(),
        // ...
    );
}

Usage

Entity:, (*2)

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Category
 *
 * @ORM\Table(name="category")
 * @ORM\Entity()
 */
class Category
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="string", nullable=false)
     */
    private $name;

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param mixed $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }


}

Controller:, (*3)

<?php

namespace AppBundle\Controller;


use AppBundle\Entity\Category;
use AppBundle\Form\CategoryType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use XPat\CrudBundle\Classes\ListConfiguration;
use XPat\CrudBundle\Controller\XPatCrudController;
use XPat\CrudBundle\Service\CrudControllerParameters;

/**
 * Class CategoryController
 * @package AppBundle\Controller
 * @Route("/category")
 */
class CategoryController extends XPatCrudController
{

    /**
     * Entity class name
     * @return string
     */
    protected function getEntity()
    {
        return Category::class;
    }


    /**
     * @param ListConfiguration $configuration
     */
    protected function listConfiguration(ListConfiguration $configuration){
        $configuration
            ->addField('id','id')
            ->addField("name","name");
    }

    /**
     * @param CrudControllerParameters $parameters
     */
    protected function configure(CrudControllerParameters $parameters)
    {
       $parameters->setTitle("Category");

       $parameters->setFormType(CategoryType::class);
    }
}

The Versions

29/01 2018

dev-master

9999999-dev https://github.com/xpat23/XPatCrudBundle

Base controller for crud

  Sources   Download

MIT

The Requires

 

by Alymbek Kydyrmyshev

crud crud bundle xpat xpat crud bundle

29/01 2018

1.0.0

1.0.0.0 https://github.com/xpat23/XPatCrudBundle

Base controller for crud

  Sources   Download

MIT

The Requires

 

by Alymbek Kydyrmyshev

crud crud bundle xpat xpat crud bundle