joomla 1.5.21
serwer lokalny
Podczas instalacji komponentu tworzy się tabela.
Select działa. Gdy jednak chcę uaktualnić/dodać dane do tabeli, pojawia się błąd
Fatal error: Call to undefined method stdClass::store() in C:\xampp\htdocs\joomla\components\com_calendar\con troller.php on line 38
fragment controller.php
Kod PHP:
function save()
{
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
$row =& JTable::getInstance('calendar', 'Table');
$row->id = JRequest::getVar('id', '0', 'post', 'string', JREQUEST_ALLOWRAW);
$row->day = JRequest::getVar('day', '', 'post', 'string', JREQUEST_ALLOWRAW );
$row->month = JRequest::getVar('month', '', 'post', 'string', JREQUEST_ALLOWRAW );
$row->year = JRequest::getVar('year', '', 'post', 'string', JREQUEST_ALLOWRAW );
$row->event = JRequest::getVar('event', '', 'post', 'string', JREQUEST_ALLOWRAW );
$row->group = JRequest::getVar('group', '', 'post', 'string', JREQUEST_ALLOWRAW );
if(!$row->store())
{
echo "********** alert('".$row->getError()."'); window.history.go(-1); </script>\n";
exit();
}
else
{
$mainframe->redirect('index.php?option=com_witaj','Zapisano poprawnie :-)');
}
}
większy fragment pliku w folderze tables
Kod PHP:
class TableCaledar extends JTable {
var $id = null;
var $day = null;
var $month = null;
var $year = null;
var $event = null;
var $group = null;
function __construct(&$db) {
parent::__construct( '#__events_calendar', 'id', $db);
}
}
Wygląda to tak, jakby $row nie dziedziczył po JTable, ale nie rozumiem dlaczego.
Jest to tylko lekko zmieniony kod z pewnego kursu, podczas szukania rozwiązania natykałem się na takie same zapisy, jednak u mnie coś nie chce działać. Może jest jakiś błąd, którego nie widzę, albo coś czego nie rozumiem?