PHP code example of nivas / easyadmin-tree-list-bundle
1. Go to this page and download the library: Download nivas/easyadmin-tree-list-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/ */
nivas / easyadmin-tree-list-bundle example snippets
namespace App\Controller\Admin;
use App\Entity\Term;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
// za custom order query
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use EasyCorp\Bundle\EasyAdminBundle\Orm\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use Doctrine\ORM\QueryBuilder;
// za ugasit akcije
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
class TermCrudController extends AbstractCrudController
{
public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{
$responseParameters->set('tree', true);
return $responseParameters;
}
// not needed, it looks better this way
public function configureActions(Actions $actions): Actions
{
return $actions
->disable(Action::BATCH_DELETE);
}
public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
{
$qb = $this->get(EntityRepository::class)->createQueryBuilder($searchDto, $entityDto, $fields, $filters);
$qb->resetDQLPart('orderBy');
$qb->addOrderBy($qb->getRootAlias().'.root', 'ASC');
$qb->addOrderBy($qb->getRootAlias().'.lft', 'ASC');
return $qb;
}
...
}
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
class OrganizationCrudController extends AbstractCrudController
{
public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{
$responseParameters->set('tree', true);
// $responseParameters->setIfNotSet('bar.foo', '...');
return $responseParameters;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.