Skip to content

False positive (?) on non-nullable property #150

@ThomasLandauer

Description

@ThomasLandauer

With this being my property

/**
 * @ORM\Column(type="string")
 * @Assert\NotBlank()
 */
private ?string $name = null;

... I'm getting this error:

Property Foo::$name type mapping mismatch: property can contain string|null but database expects string.

So what's the correct way to set up a property that cannot be NULL when being saved to the database?
(It has to be nullable in PHP (i.e. ?string) for Symfony forms to work, see EasyCorp/EasyAdminBundle#3889 (comment))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions