⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to update a n n relation table via an other table



Sitraka Razafimamy
  • profile picture
  • Member

Posted 07 May 2013 - 11:11 AM

Hi
 
I'm new, I have a  question. Is it possible to create a relation_n_n that contains data (date, for example) you must update.
 
I show you an example:
 
I have 2 tables
Employe (id_employe, nom, prenom)
Action(id_action, type, libelle)
 
and the relation table
EmployeAction (id_employe, id_action, date)
 
I would like to update the  "EmployeAction" table from the "Employe" table.
Is this possible with set_relation_n_n () function? How?
 
Can you help me please!!!

davidoster
  • profile picture
  • Member

Posted 07 May 2013 - 14:10 PM

Hello and welcome to the forums.

Actually this has nothing to do with the fact that you are using a set_relation_n_n.

At your employe table you use one (or all) of these functions:

before_insert

after_insert

before_update

after_update

 

Which one(s) you use and what you do within these callbacks it depends on the logic you want to implement.


Sitraka Razafimamy
  • profile picture
  • Member

Posted 07 May 2013 - 15:07 PM

Thank you for your welcome and your reply. I will use one of these functions.  :)


victor
  • profile picture
  • Member

Posted 07 May 2013 - 15:12 PM

You should try each of all functions from the API page before you will make the project. you will be spent a little time but then you won't have any questions. Really, it will save your time.

Sitraka Razafimamy
  • profile picture
  • Member

Posted 07 May 2013 - 15:43 PM

You are right, I 'll try each of all functions from th API. If I encounter some problems, I think I always ask for a little assistance.