As I develop the back end manage record functionality of a component, I am getting "Save failed with the following error: Unknown column 'created' in 'field list'"
I built the helloworld component according to the Joomla docs tutorial: https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Introduction
I am trying to extend the back-end from simply displaying the list of items ( https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Basic_backend ) to modify (i.e., manage) each record. For this, I copied the back-end's com_banners banner view and the related files (controller, model, table, etc.), and adjusted the files to reflect the structure of my component's single record.
My component's table only has 3 columns, id, greeting, and state.
The manage record view for my component is displaying the record correctly, but when I modify the greeting and try to save it, I get the error
"Save failed with the following error: Unknown column 'created' in 'field list'"
Like I said, the table of my component only has 3 columns, id, greeting, and state. The error implies the query included the additional column 'created'. Why is this additional column added to the query?
UPDATE:
@Sharky suggested to delete $this->created = JFactory::getDate()->toSql();
from the Table class of the component. I did, and then I got the error
"Save failed with the following error: Unknown column 'modified' in 'field list'"
Right now, the Table class for my component looks like:
class HelloWorldTableHelloWorld extends JTable
{
/**
* Constructor
*
* @param JDatabaseDriver $db Database connector object
*
* @since 1.5
*/
public function __construct(&$db)
{
parent::__construct('#__helloworld', 'id', $db);
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_helloworld.helloworld'));
$this->setColumnAlias('published', 'state');
}
}