Mjoin - additinal fields besides the composite keys
Mjoin - additinal fields besides the composite keys
In the 1-to-Many example here
is it possible to have additional fields in table user_permission
for example expiry_date user_id | access_id | expiry_date
how to read this new field considering the example code? and is it possible to have preCreate
event inside the Mjoin?
Editor::inst( $db, 'users' )
->field(
Field::inst( 'users.first_name' )
)
->join(
Mjoin::inst( 'permission' )
->link( 'users.id', 'user_permission.user_id' )
->link( 'permission.id', 'user_permission.access_id' )
->order( 'name asc' )
->fields(
Field::inst( 'id' )
->validator( 'Validate::required' )
->options( Options::inst()
->table( 'permission' )
->value( 'id' )
->label( 'name' ),
Field::inst( 'name' )
)
)
->process($_POST)
->json();
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm sorry no. At the moment the server-side libraries assume that the link table will only have the linking reference keys. It does not allow for other meta data. That is a limitation I'm aware of and it does need to be addressed in future, but we haven't yet scoped out that work.
Allan
thanks for your prompt answer. there's always an alternative which in my case even makes my software better. So I guess thanks for this limitation.