Skip to content

Type entity property as numeric-string while database column type is string #187

Closed
@ruudk

Description

@ruudk

I have an entity with the following column definition:

    /**
     * @ORM\Column(name="amount", type="string")
     */
    private string $amount;

Now I want to type that property as numeric-string because it will only ever contain numbers anyway.

    /**
     * @var numeric-string
     *
     * @ORM\Column(name="amount", type="string")
     */
    private string $amount;

But I'm getting this error:

Property MyEntity::$amount type mapping mismatch: database can contain string but property expects string.

I don't know how to solve this. Is it even possible?

And is the error message correct? Shouldn't it say:

Property MyEntity::$amount type mapping mismatch: database can contain string but property expects numeric-string.

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