title: Write to multiple tables in joomla component?
body: <p>I'm trying to create a component (front end) that uses multiple tables. I found 1 or 2 post that partially answer to the question but none really does. The point seems always simple and evident for the one who knows how to do it but it is never really explained (or I missed the right post).</p>
  
  <p>In my component, the user enters data in one view that need to be stored in two tables:
  the standard Joomla User table i.e. # __users
  an additional table to store data that are not included in Joomla i.e. # __users_complements</p>
  
  <p>I'm a beginner, so maybe I'm wrong, but I understood that the standard functions of joomla can only save results of a form in one table .
  In my case, I guess that I have to override the standard functions in my model: com_component / model / my_model.php.</p>
  
  <p>1) I'm confused because I do not really understand which function must be overrided: save ()? store ()? other?</p>
  
  <p>2) Let's say I override the save() function, should I rewrite all the code to save data (explode the data array and create all the update queries) or should I create 2 standard table objects.</p>
  
  <p>In this case, (2 objects) it seems weird to send each time the whole data array to the parent function as I know that a part is for table 1 and the other part for the table 2. I should be able to split before don't I?</p>
  
  <p>3) Should I create 2 models and manage those models from my controller when I get back data from the form and call the save function of the model?</p>
  
  <p>Could you help me to clarify how to do this saving in multiple tables?
  An example with code will be very much appreciated.
  Thank you</p>