Skip to content

Property $id type mapping mismatch: database can contain Symfony\Component\Uid\Uuid but property expects Symfony\Component\Uid\UuidV7 #695

@siggidiel

Description

@siggidiel

Hey guys. I updated my phpstan/phpstan-doctrine dependency phpstan/phpstan-doctrine (2.0.6 => 2.0.10) and now I am receiving the following error:

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   src/Entity/Product.php                                                                                                                                      
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  27     Property App\Entity\Product::$id type mapping mismatch: database can contain Symfony\Component\Uid\Uuid but property expects Symfony\Component\Uid\UuidV7.  
         🪪  doctrine.columnType                                                                                                                                     
         at src/Entity/Product.php:27                                                                                                                                
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------ 

This is how my entity looks like:

use App\Repository\ProductRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\UuidV7;

#[ORM\Entity(repositoryClass: ProductRepository::class)]
class Product
{
    #[ORM\Id]
    #[ORM\Column(type: UuidType::NAME)]
    private UuidV7 $id;

    ...
}

And I can't find a way to make this work in PHPStan playground with the doctrine extension 🤔 So I can't paste any link here for reproducing it.
What's the issue here? It's a type mismatch, okay. It worked before. What could I do to fix that?

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