I have two tables user
and comment
: a user can post a comment to another user.
I want create two foreign key from comment
table to user
table witch one contain comment writer user_id
and another contain comment owner user_id
.
i use this code :
$agent->link($TB_Comment,array("comment"=>$comment, "indate"=> time()))->sharedUsers = $user ;
and it create this column in my table (user_id , sharedUser_Id)
but i want to rename sharedUser_Id
to writerId
...
how can i do this? and is there a way to create custom forign key with favorite name in redbeanphp framework ?
With your example, you can achieve something very close (writer_id, instead of writerId) to what you want easily using aliases.
See this snippet: