mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fixed: [scope] api, picker and admin form consider 'active' property
* add active field in admin scope form * issue: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/675
This commit is contained in:
parent
52512e45fc
commit
1eb1e2ec24
16
src/Bundle/ChillMainBundle/Controller/ScopeApiController.php
Normal file
16
src/Bundle/ChillMainBundle/Controller/ScopeApiController.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ScopeApiController extends ApiController
|
||||
{
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
if ('_index' === $action) {
|
||||
$query->andWhere($query->expr()->eq('e.active', "'TRUE'"));
|
||||
}
|
||||
}
|
||||
}
|
@ -625,6 +625,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\Scope::class,
|
||||
'controller' => \Chill\MainBundle\Controller\ScopeApiController::class,
|
||||
'name' => 'scope',
|
||||
'base_path' => '/api/1.0/main/scope',
|
||||
'base_role' => 'ROLE_USER',
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\MainBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@ -21,7 +22,13 @@ class ScopeType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('name', TranslatableStringFormType::class);
|
||||
->add('name', TranslatableStringFormType::class)
|
||||
->add('active', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'Active' => true,
|
||||
'Inactive' => false,
|
||||
]])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user