Jump to content

Implementing 1-1 relation ???


  • Please log in to reply
3 replies to this topic

#1 rostamiani



  • Members
  • PipPip
  • 13 posts

Posted 17 April 2016 - 02:26 PM



I really need to implement 1-1 relation between two tables. These are my tables:


Users: id, username, email, password

Userinfo: id, Isers_id, firstname ,lastname, mobile, address, ...


The users table is read only... This is a suggested solution:



But the problem is that I cannot set two 'users_id' columns!!!


What do you suggest?




#2 Paul Savostin

Paul Savostin

    Advanced Member

  • Members
  • PipPipPip
  • 229 posts
  • LocationUkraine

Posted 03 May 2016 - 04:04 PM

U cant implement 1-1 relation with crud by default. But u can create after insert_after/update_after function for u purposes

#3 JimRustler



  • Members
  • Pip
  • 7 posts

Posted 03 May 2016 - 11:15 PM

I had this issue before, i solved it using views, and replacing the add, edit, read links to the original table controller methods.


When using views instead of tables you need to add $crud->set_primary_key("your_view_primary_key_of_table");

#4 mckaygerhard



  • Members
  • PipPip
  • 16 posts

Posted 05 October 2016 - 08:35 PM

using views?


how can i set views, there any example.. i have id_data and des_data, when i set the relation only one of those can be show as a column..



    $crud = new grocery_CRUD();
	$output = $crud->render();

the results are that the column id_data does not show, and only show the values of des_data column!


i want to show also the id_data column but by separate! how?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users