Reputation: 683
I have two entities :
In SonataAdmin, I want to manage my Users (done) but I need to add fields in the table that are in UserInfo (name, first name...).
Any idea ?
Thanks !
Upvotes: 1
Views: 323
Reputation: 607
There must be existing a relation in between user and userInfo. say OneToOne relation. Then from userInfo entity u will get the user data and will show on the Admin side. i.e.
$subject = $this->getSubject();
$user = $this->subject->getUser();
Will give you user, if you want to further perform actions on that user.
Upvotes: 0
Reputation: 840
Depending on the relationship type, you should be able to just reference userinfo.firstName
, eg:
public function configureShowFields(ShowMapper $show)
{
$show->add('userinfo.firstName')
->add('userinfo.dob');
}
Of course, if you have many userinfo
's attached to the entity I don't think this will work.
Upvotes: 1