[Solar-talk] Sql_Model insert not working!
Jeff Surgeson
solar at 3hex.com
Fri Apr 6 23:12:50 PDT 2007
Hi All
Dont know if anyone else has tried inserting a row using Sql_Model class in
svn but it does not seem to work as is without some modification. I assumed
that as it was in svn that the insert/update methods worked but it would
appear not, I see Paul also has todo: notes at top of class "@todo Add
master-focus insert, update, and delete" however they appear to be completed?
In order to get it to insert a new row I had to comment out
$this->_data = array_merge(
$this->fetchNew()->toArray(),
$this->_data
);
at the top of _insert() in Sql_Model, if I leave it in it generates a uncaught
Solar_Exception ERR_FOCUS_NOT_MASTER with message 'ERR_FOCUS_NOT_MASTER'
information array ( 'focus' => 'record', ) Stack trace:
#0 /var/www/localhost/htdocs/libsvn/Solar.php(862):
I tried to use Solar form data as with Sql_Table data but could not get that
to work either. I used the following truncated code to insert a new record.
Bulldog_Model_News extended from Solar_Sql_Model and with database table pre
created.
$this->_news = Solar::factory('Bulldog_Model_News');
.....
$item = $this->_news->fetchNew();
$item->editor_handle = 'jeff';
$item->subject = 'This is a subject';
$item->body = 'This is a body message';
$item->save();
...
--
...........::::::...........
Jeff Surgeson / South Africa
More information about the solar-talk
mailing list