PHP code example of dakataa / crud

1. Go to this page and download the library: Download dakataa/crud library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dakataa / crud example snippets


   namespace App\Controller;

   use App\Entity\Product;
   use App\Form\ProductType;
   use Dakataa\Crud\Attribute\Entity;	
   use Dakataa\Crud\Attribute\EntityType;
   use Dakataa\Crud\Controller\AbstractCrudController;
   use Doctrine\ORM\QueryBuilder;
   use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
   
   #[Route('/product')]
   #[Entity(Product::class)]
   #[EntityType(ProductType::class)]
   class ProductController extends AbstractCrudController
   {
   }
   

    public function buildCustomQuery(Request $request, QueryBuilder $query): AbstractCrudController
    {
        $query
            ->andWhere('a.enabled = true');
			
        return $this;
   }
    
shell
	php bin/console make:entity Product
	php bin/console make:form ProductType Product
 	...
	php bin/console make:migration
	php bin/console doctrine:migrations:migrate
    
shell
    php symfony crud:make:entity Product ProductType ProductController