You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
i got a type missmatch on persist: Cannot assign Ramsey\Uuid\Lazy\LazyUuidFromString to property SharedBookshelf\Entities\User::$id of type Ramsey\Uuid\Uuid
versions:
doctrine/orm: 2.8.1
ramsey/uuid-doctrine: 1.6.0
The entity code:
<?php declare(strict_types=1);
namespace SharedBookshelf\Entities;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata;
use Ramsey\Uuid\Doctrine\UuidGenerator;
use Ramsey\Uuid\Uuid;
use SharedBookshelf\Repositories\UserRepository;
class User implements Entity
{
private Uuid $id;
private string $username = '';
private string $password = '';
public static function loadMetadata(ClassMetadata $metadata): void
{
$builder = new ClassMetadataBuilder($metadata);
$builder->createField('id', 'uuid')
->makePrimaryKey()
->generatedValue('CUSTOM')
->setCustomIdGenerator(UuidGenerator::class)
->build();
$builder->setCustomRepositoryClass(UserRepository::class);
$builder->addField('username', 'string');
$builder->addField('password', 'string');
}
public function getId(): Uuid
{
return $this->id;
}
public function getUsername(): string
{
return $this->username;
}
public function setUsername(string $username): void
{
$this->username = $username;
}
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): void
{
$this->password = $password;
}
}
This seems to be because of ramsey/uuid#327 and the addition of LazyUuidFromString in 4.1. I'm having a similar issue with the version 4.1 of ramsey/uuid
Hello,
i got a type missmatch on persist:
Cannot assign Ramsey\Uuid\Lazy\LazyUuidFromString to property SharedBookshelf\Entities\User::$id of type Ramsey\Uuid\Uuid
versions:
The entity code:
i am not 100% sure if this is due to the fact that i use the static php meta function, i took your annotation example as the basis in combination with: https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/php-mapping.html#php-mapping
The detailed error with trace (project: https://github.com/xuedi/sharedBookshelf):
The text was updated successfully, but these errors were encountered: