-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Symfony Form inherit_data (#34)
- Loading branch information
1 parent
87426de
commit 7aaaf5c
Showing
8 changed files
with
163 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the composer-write-changelogs project. | ||
* | ||
* (c) Dev Spiriit <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Spiriit\Bundle\FormFilterBundle\Tests\Fixtures\Filter; | ||
|
||
use Doctrine\ORM\Query\Expr; | ||
use Doctrine\ORM\QueryBuilder; | ||
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderExecuterInterface; | ||
use Spiriit\Bundle\FormFilterBundle\Tests\Fixtures\Entity\Item; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
/** | ||
* Form filter for tests. | ||
* | ||
* @author Bart Heyrman <[email protected]> | ||
*/ | ||
class InheritDataFilterType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder | ||
->add('item', ItemFilterType::class, [ | ||
'add_shared' => function (FilterBuilderExecuterInterface $qbe) { | ||
$closure = function (QueryBuilder $filterBuilder, $alias, $joinAlias, Expr $expr) { | ||
$filterBuilder->leftJoin($alias . '.item', $joinAlias); | ||
}; | ||
|
||
|
||
$qbe->addOnce($qbe->getAlias().'.item', 'item', $closure); | ||
}, | ||
'data_class' => Item::class, | ||
]) | ||
->add('option', OptionFilterType::class, [ | ||
'inherit_data' => true | ||
]) | ||
; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getBlockPrefix(): string | ||
{ | ||
return 'inherit_filter'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
bootstrap="vendor/autoload.php" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
> | ||
|
||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<testsuites> | ||
<testsuite name="SpiriitFormFilterBundle Test Suite"> | ||
<directory>./Tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage> | ||
<include> | ||
<directory>./</directory> | ||
</include> | ||
<exclude> | ||
<directory>./Resources</directory> | ||
<directory>./Tests</directory> | ||
<directory>./vendor</directory> | ||
</exclude> | ||
</coverage> | ||
|
||
<testsuites> | ||
<testsuite name="SpiriitFormFilterBundle Test Suite"> | ||
<directory>./Tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
|
||
<whitelist> | ||
<directory>./</directory> | ||
<exclude> | ||
<directory>./Resources</directory> | ||
<directory>./Tests</directory> | ||
<directory>./vendor</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
|
||
<php> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"></env> | ||
</php> | ||
|
||
<listeners> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
</listeners> | ||
<php> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> | ||
</php> | ||
<listeners> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
</listeners> | ||
</phpunit> |