Mike C Tue Aug 09 09:34:03 -0400 2011

Subject: Calling model save() creates four instances in table

I'm not sure why this is happening but when I save my model, it creates four entries in the table. This has never happened before, so I'm at odds with why it's happening now. I tried removing all my extra logic and associations but it hasn't helped. One thing to note is that I am using one base table called task and several extending tables called things like work_task and home_task. I then set an enum in my task table to tell me which type of task extends it.

I would have liked to use inheritance where task extends the ActiveRecord class and then each subclass would extend the task parent class, but I wasn't sure how this would work with tables.

Anyone have any ideas why I am getting several entries when doing the following:
$task = new Task();
$task->save();

Thanks!


Mike C Wed Aug 10 08:41:11 -0400 2011

Well I feel dumb. I had some routing rules that defaulted not found pages to the same page generating the models. Therefore, several inserts for the same code.

PHPActiveRecord is perfect, keep up the good work. Sorry I cluttered your forum.

(1-1/1)