Actions

J2.5 talk

Difference between revisions of "Developing a MVC Component/Adding configuration"

From Joomla! Documentation

Line 1: Line 1:
 +
In the function
 +
/**
 +
* Overloaded load function
 +
*
 +
* @param      int $pk primary key
 +
* @param      boolean $reset reset data
 +
* @return      boolean
 +
* @see JTable:load
 +
*/
 +
public function load($pk = null, $reset = true)
 +
{
 +
if (parent::load($pk, $reset))
 +
{
 +
// Convert the params field to a registry.
 +
$params = new JRegistry;               
 +
                      // loadJSON is @deprecated    12.1  Use loadString passing JSON as the format instead.
 +
                      // $params->loadString($this->item->params, 'JSON');
 +
//------------------------------------------------------------
 +
                      $params->loadJSON($this->item->params);
 +
//------------------------------------------------------------
 +
 +
$this->params = $params;
 +
return true;
 +
}
 +
else
 +
{
 +
return false;
 +
}
 +
}
  
 +
The line bracketed above is actually, $params->loadJSON($this->params);
 +
I am not sure which is 100% correct.

Revision as of 07:51, 2 May 2012

In the function /** * Overloaded load function * * @param int $pk primary key * @param boolean $reset reset data * @return boolean * @see JTable:load */ public function load($pk = null, $reset = true) { if (parent::load($pk, $reset)) { // Convert the params field to a registry. $params = new JRegistry;

                      // loadJSON is @deprecated    12.1  Use loadString passing JSON as the format instead.
                      // $params->loadString($this->item->params, 'JSON');

//------------------------------------------------------------

                      $params->loadJSON($this->item->params);

//------------------------------------------------------------

$this->params = $params; return true; } else { return false; } }

The line bracketed above is actually, $params->loadJSON($this->params); I am not sure which is 100% correct.