I encounter an this error with Doctrine and Symfony2:
Could not resolve type of column "id" of class "ST\UserBundle\Entity\User"
Statistic
class Statistique
{
// ...
// @ORM\ManyToOne(targetEntity="ST\UserBundle\Entity\User")
// @ORM\JoinColumn(name="idPro", referencedColumnName="id")
private $user;
}
User
use FOS\UserBundle\Model\User as BaseUser;
// @ORM\Table(name="tiers_prov3")
class User extends BaseUser
{
/**
* @ORM\Column(name="TIE_ID", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="NONE")
*/
protected $id;
// ...
}
I can't figure it out.
Your column name for $id property in User class is "TIE_ID". So try to use this name instead of id in your Statistic class :
/**
* @var string
*
* @ORM\ManyToOne(targetEntity="ST\UserBundle\Entity\User")
* @ORM\JoinColumn(name="idPro", referencedColumnName="TIE_ID") <== here
*/
private $user;
In Doctrine annotations, columns names - like in @ORM\Column(name="x"...)
and @ORM\JoinColumn(name="y", referencedColumnName="x" ...)
- are real database column names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With