Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Model_Crud duplicate when trying to update
Here is my code :
$animals = Model_Informations::find_all('chat');
foreach($animals as $animal)
$animal->slug = Inflector::friendly_title($animal->race);
Do someone know why this is creating duplicates in my database? I read the doc and when the records exist, the method is suppose to do an update.
The problem seems to come from the table I got from an other dev. Could it be the table unique constraint that cause it add value instead of updading them. I tried to update on other tables and it worked like a charm. I think it would be important to mention that I tried to update other column than slug and I tried outside the foreach width find_one_by_X.
Found it, the table had two primary key... my god haven't even checked that ....
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion