php - Joomla 2.5 MVC Model prepareTable function -
while developing mvc component, i'm faced following problem: before saving posted data default.php, data should revised, if necessary. know far, protected function preparetable(&$table) in specific model should cover need. started simple approach, follows:
protected function preparetable(&$table){ $table=$this->gettable(); $table->image="helloworld"; } my expectation is, after submitting template specific field in table has value "helloworld", isn't.
perhaps, give me advice how handle preparetable() function?
thank you
if else setup correctly preparetable(&$table) method has table object passed it.
generally preparetable() in class wouldn't gettable(), replace $table being passed in has row data bound it. replacing decouple work done.
i remove line method looks like:
protected function preparetable(&$table){ $table->image="helloworld"; } if @ simplest implementation of preparetable() in joomla core files, in com_banners see similar method;
/** * prepare , sanitise table data prior saving. * * @param jtable jtable object. * @since 1.6 */ protected function preparetable(&$table) { $table->name = htmlspecialchars_decode($table->name, ent_quotes); }
Comments
Post a Comment