-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
I cannot find a way to satisfy the case
Property App\User::$stats type mapping mismatch: database can contain App\UserStats|null but property expects App\UserStats.
I have the following mapping :
<?php
class User
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var UserStats
*
* @ORM\OneToOne(targetEntity="App\UserStats", mappedBy="user")
*/
protected $stats;
// ... other properties
}
class UserStats
{
/**
* @var User
*
* @ORM\Id
* @ORM\OneToOne(targetEntity="App\User", inversedBy="stats")
*/
private $user;
// ... other properties
}
If I add @ORM\JoinColumn(nullable=false)
on User::$stats
property then Doctrine is broken because JoinColumn
annotation is expected on the owning side of the one to one relationship.
So I'm stuck with this case, because I can't explain to phpstan that my property isn't nullable :/
yblatti
Metadata
Metadata
Assignees
Labels
No labels