8000 [DoctrineBridge] Fix required guess of boolean fields by enumag · Pull Request #16302 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Fix required guess of boolean fields #16302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[DoctrineBridge] Fix required guess of boolean fields
  • Loading branch information
enumag committed Oct 22, 2015
commit 1ee5ab5e017d7f2cb2a3fccb817546422891f185
5 changes: 3 additions & 2 deletions src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Symfony\Bridge\Doctrine\Form;

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\Common\Persistence\Mapping\MappingException;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException as LegacyMappingException;
use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
Expand Down Expand Up @@ -95,7 +96,7 @@ public function guessRequired($class, $property)

// Check whether the field exists and is nullable or not
if ($classMetadata->hasField($property)) {
if (!$classMetadata->isNullable($property)) {
if (!$classMetadata->isNullable($property) && Type::BOOLEAN !== $classMetadata->getTypeOfField($property)) {
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
}

Expand Down
0