[Solar-talk] save form data (model branch)

Jeff Surgeson solar at 3hex.com
Tue Apr 3 05:19:22 PDT 2007


Hi

I am trying to save a record from a data form in the new model branch.
Below is a truncated version of what I am trying to do which works with 
sql_table but not new sql_model.

// create a news model object
$this->_news  = Solar::factory('Bulldog_Model_News');

public function actionAdd()
{
	// get a new record with default values
	$item = $this->_news->fetchNew();

	// get a form object
	$form = $this->_news->addForm();
	
	// now populate the the submitted POST values to the form
        $form->populate();

        if ($this->_isProcess('save') && $form->validate()) {

        	// load data from the form input
        	$item->load($form->values('_news'));

        	// save the data
      		$item->save();
	}
}

$item->load() generates a ERR_METHOD_NOT_IMPLEMENTED exception on the load() 
method. Without the call to load I get a ERR_FOCUS_NOT_MASTER form feedback.

I assume that is because the fetchNew() and Form values are not being merged.

Is this as a result of unfinished  model/form stuff  and am I wasting my time 
trying to get this to work with the new model branch, should I wait until 
Paul finishes the Form_Load_Model class? or is there a way to save records 
from form objects? 

-- 
...........::::::...........
Jeff Surgeson / South Africa


More information about the solar-talk mailing list