Here is the class definition
class MyTable extends JTable{
public $parent_id = null;
public $hits = 1;
function __construct()
{
parent::__construct('#__mytable', 'parent_id', JFactory::getDbo());
}
}
and here is the problematic code.
$table = new MyTable();
if(!$table->load($id)){ //If the record doe not exist
$table->parent_id=id; //Setting the id for the new row
echo "Should be storing new table row...";
$table->store(true);//New record should be created here
}else{
echo "Record existed existed : ";
$table->hit();
echo "$table->hits hits";
}
The problem is that $table->store returns true but does not create any records in the database.
If I add records manually, load() works fine. But it fails to INSERT a new row. getErrors() return NULL