PHP code example of kachnitel / admin-bundle
1. Go to this page and download the library: Download kachnitel/admin-bundle 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/ */
kachnitel / admin-bundle example snippets
use Kachnitel\AdminBundle\Attribute\Admin;
#[Admin]
class Product
{
// Your existing entity...
}
Kachnitel\DynamicFormBundle\KachnitelDynamicFormBundle::class => ['all' => true],
Kachnitel\EntityComponentsBundle\KachnitelEntityComponentsBundle::class => ['all' => true],
Kachnitel\AdminBundle\KachnitelAdminBundle::class => ['all' => true],
#[Admin(columns: ['id', 'name', 'price'])]
#[ColumnPermission('ROLE_HR')]
private float $salary;
#[Admin(enableColumnVisibility: true)]
#[AdminAction(name: 'duplicate', label: 'Duplicate', route: 'app_product_duplicate')]
#[AdminAction(name: 'approve', label: 'Approve', condition: 'entity.status == "pending"')]
#[AdminAction(
name: 'refund',
label: 'Refund',
method: 'POST',
condition: [RefundService::class, 'canRefund'],
confirmMessage: 'Refund this order?',
)]
#[AdminActionsConfig(exclude: ['edit'])]
#[AdminAction(name: 'show', label: 'Preview', icon: '🔍', override: true)]
#[Admin(label: 'Products')]
class Product { }
// Visit /admin/product/new — fields generated from Doctrine metadata, no FormType written
// src/Form/ProductFormType.php
class ProductFormType extends AbstractType { /* ... */ }
#[AsLiveComponent(name: 'App:Form:PurchaseOrder')]
final class PurchaseOrderForm extends AdminEntityForm { /* ... */ }
#[AdminColumn(editable: false)] // exclude from the form
#[AdminColumn(editable: 'entity.status != "locked"')] // conditional
#[Admin(label: 'Products', archiveExpression: 'item.archived')]
class Product
{
private bool $archived = false;
}
#[Admin(archiveExpression: 'item.deletedAt')]
class Order
{
private ?\DateTimeImmutable $deletedAt = null;
}
#[Admin(label: 'Categories', archiveDisabled: true)]