Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
PK as FK
  • Models: http://scrp.at/2D When inserting in thread->post->video where PostVideo's PK is also the FK for 'Posts' it returns this error.
    Fuel\Core\Fuel_Exception [ Error ]: Primary key cannot be changed.
    

    Is it then not possible for a one-to-one relationship with the FK as PK ? the FK is unique as its the other tables PK (auto increment) and they cascade delete together. Also, this -might- only be a problem in a one-to-many and then one-to-one. Since I had done similar for another project in a one-to-one relationship and I recall it worked.
  • You shouldn't use PKs as FKs, if it works for one-one it's by accident not design. A PK should be unique and is unchangeable for a reason.
  • Jelmer Schreuder wrote on Sunday 5th of June 2011:
    You shouldn't use PKs as FKs, if it works for one-one it's by accident not design. A PK should be unique and is unchangeable for a reason.

    Thanks, just wanted to confirm.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion