Allow to remove all fields of a form except a given list:
public function unsetAllExcept($fields = array()) { foreach($this->getObject()->toArray(BasePeer::TYPE_FIELDNAME) as $key => $val) { $tmp[] = strtolower($key); } $tmp = array_diff($tmp, $fields); foreach($tmp as $value) { unset($this[$value]); } }
Remove created_at, updated_at ...
$this->unsetAllExcept(array('comment'));
logs
8395.2 KB
Commentaires sur ce snippet
This looks awesome! Thank you for your information!
Interesting thing! That's awesome! I can't wait to get into it. This looks awesome! Thank you for your information!
This looks awesome! Thank you for your information!
Ajouter un commentaire / Add a comment