array_intersect not diff ________________________________
From: Dave Maharaj :: WidePixels.com [mailto:[email protected]] Sent: April-30-09 2:20 AM To: [email protected] Subject: Whitelist Problem I been reading the aticle here http://teknoid.wordpress.com/2009/03/11/blacklist-your-model-fields-for-save / and modified the code to this: $whitelist = array('system_id'); $this->User->save($this->data, true, array_diff(array_keys($this->User->$join_table->schema()), $whitelist)); //$join_table is UsersSystem Because this is for a form i dont want anyone adding fields or changing fields...so i manualy changed in FireBug <input type="text" id="UserFirstname" value="" maxlength="45" name="data[User][firstname]"/> to <input type="text" id="UserId" value="" maxlength="45" name="data[User][id]"/> and sure enough it save to the database which is not good! I need to allow only the fields in the HABTM $join_table to be saved to or updated and nothing else. i did a debug on the save and the schema shows only the $join_table fields which is what i want and i want to allow only those fields to be saved to. What am I doing wrong? Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
