Я расширяю один компонент Joomla для Joomla 3. Я могу получить данные, но во время хранения данных я столкнулся с этой проблемой:
Table budget not supported. File not found.
Имя моей таблицы: vaccount_budget.
Моя модель: Budget.php
class VaccountModelBudget extends JModelList
{
function __construct()
{
parent::__construct();
$array = JRequest::getVar('cid', 0, '', 'array');
$this->setId((int)$array[0]);
}
function setId($id)
{
// Set id and wipe data
$this->_id = $id;
$this->_data = null;
}
function &getData()
{
// Load the data
if (empty( $this->_data )) {
$query = ' SELECT * FROM #__vaccount_budget '.
' WHERE id = '.$this->_id;
$this->_db->setQuery( $query );
$this->_data = $this->_db->loadObject();
}
if (!$this->_data) {
$this->_data = new stdClass();
$this->_data->id = null;
$this->_data->tranid = null;
$this->_data->quantity = null;
$this->_data->amount = null;
$this->_data->from = null;
$this->_data->to = null;
$this->_data->created_by = null;
}
return $this->_data;
}
function store()
{
$row = $this->getTable('budget');
$data = JRequest::get( 'post' );
$row->load(JRequest::getInt('id', 0));
$user = JFactory::getUser();
$uID = $user->id;
$data['created_by'] = $uID;
$data['from'] = "2015-02-18";
$data['to'] = '2015-02-18';
if (!$row->bind($data)) {
$this->setError($row->getError());
return false;
}
// Make sure the transaction record is valid
if (!$row->check()) {
$this->setError($row->getError());
return false;
}
// Store the web link table to the database
if (!$row->store()) {
$this->setError( $row->getError() );
return false;
}
return true;
}
Контроллер: Budget.php
class VaccountControllerBudget extends JControllerForm
{
function __construct()
{
parent::__construct();
// Register Extra tasks
$this->registerTask( 'add' , 'edit' );
}
function edit($key = NULL, $urlVar = NULL)
{
JRequest::setVar( 'view', 'budget' );
JRequest::setVar( 'layout', 'edit' );
JRequest::setVar('hidemainmenu', 1);
$model = $this->getModel('budget');
parent::display();
}
function save($key = NULL, $urlVar = NULL)
{
$model = $this->getModel('budget');
$task = $this->getTask();
$link = $task=="apply"?'index.php?option=com_vaccount&view=budget&task=budget.edit&cid[]='.JRequest::getInt('id', 0):'index.php?option=com_vaccount&view=budgets';
if($task=="save") {
//$model->checkIn();
if ($model->store($post)) {
$msg = JText::_( 'TRANSACTION_SAVED' );
$this->setRedirect($link, $msg);
} else {
$msg = $model->getError();
jerror::raiseWarning('', $msg);
$this->setRedirect($link);
}
}
}
Я могу получить данные из базы данных, но не могу хранить данные, когда форма публикует данные. В чем я ошибаюсь?