symfony - FOSUserBundle Entity with ManyToOne relation -
i have abstractuser super class extends fosuser, have entities extends abstractuser fields related class. instance customer has manytoone relation city entity.
now when try log-in fosuser login form i'm getting error:
.... sqlstate[42s22]: column not found: 1054 unknown column 't0.city' in 'field list'
of course there no city field in users table because it's relation column named city_id. can shed light me why doctrine builds query this? missing ?
thanks in advance.
here related code parts.
abstractuser:
/** * @orm\table(name="users") * @orm\entity * @orm\mappedsuperclass * @orm\inheritancetype("single_table") * @orm\discriminatorcolumn(name="discr", type="string") * @orm\discriminatormap({"admin"="admin", "customer"="customer", "seller"="seller"}) */ abstract class abstractuser extends fosuser { /** * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; public function __construct() { parent::__construct(); } }
customer:
/** * @orm\entity */ class customer extends abstractuser { .... /** * @var city $city * @orm\manytoone(targetentity="city", inversedby="customers") */ private $city; .... }
city:
/** * @orm\table(name="city") * @orm\entity */ class city { .... /** * @var arraycollection $customers * @orm\onetomany(targetentity="customer", mappedby="city") */ private $customers; .... }
i believe visibility on $city
, $customers
has protected, not private.
Comments
Post a Comment