Download the PHP package pportelette/crud-bundle without Composer
On this page you can find all versions of the php package pportelette/crud-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pportelette/crud-bundle
More information about pportelette/crud-bundle
Files in pportelette/crud-bundle
Package crud-bundle
Short Description This bundle provides basic CRUD endpoints for Doctrine entities
License MIT
Informations about the package crud-bundle
CrudBundle
This bundle provides basic CRUD endpoints for one given Doctrine entity:
- GET
/entity
returns a paginated result - GET
/entity/list
returns an array of objects - GET
/entity/{id}
returns an object - POST
/entity
creates an entity - PUT
/entity/{id}
updates an entity - DELETE
'/entity/{id}
delete an entity
Installation
Open a command console, enter your project directory and execute:
Applications that don't use Symfony Flex
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
Usage
In the following sections we will consider that we have a simple Doctrine Entity 'Category' with its Doctrine repository 'CategoryRepository'.
Create ViewModel
First of all is to create a ViewModel object that will represent our entity in the front.
Extend Repository
Extend Controller
Configure routes
Drive all requests starting by /category
to CategoryController.
At this point the 6 CRUD endpoints are available.
Custom Service
It is possible to override the service methods.
For this create a service CategoryService.php
that extends CrudService
and override a method that complies with the Pportelette\CrudBundle\Service\CrudServiceInterface such as:
Custom Repository
It is possible to override the repository methods.
Your repository already extends the CrudRepository. Simply add a method that complies with the Pportelette\CrudBundle\Repository\CrudRepositoryInterface:
All versions of crud-bundle with dependencies
doctrine/doctrine-bundle Version ^2.7
pportelette/pageable-bundle Version ^0.1.5
symfony/framework-bundle Version ^5.3|^6.0|7.0.*
symfony/serializer Version ^5.3|^6.0|7.0.*
symfony/yaml Version ^5.3|^6.0|7.0.*