0

I have component called "MyComponent" and table class called "MyComponentTableSample". In model I create instance to table:

$table = JTable::getInstance('Sample', 'MyComponentTable');

then I want to setDBO

$table->setDBO($this->getTargetLanguageDbo());

and execute table's method that contains:

$row = new stdClass();
$row->primary_key = 1;
$row->field_name = "something";
$this->bind($row);
$this->store(TRUE);

Unfortunately, it doesn't insert/update row in database. I checked and bind() and store() return true. When I call out $this->_db from table's method, it returns me

["_database":"JDatabase":private]=>
  string(20) "my_databaseName"

what is correct and it means dbo has been set, but still there is no row in database. $this->getErrors() from table returns empty array

  • 1
    just a quick suggestion, try replacing $this with $table. – subashbasnet8 Feb 6 '15 at 4:57
  • I think you are right. It should be an answer. – Dmitry Rekun Feb 6 '15 at 7:17
  • No, it's not a problem. $this I'm using in my table what extends JTable so it's ok. – turson Feb 6 '15 at 7:19
  • JTable->setDBO($db) expects a JDatabaseDriver object. Are you sure your $this->getTargetLanguageDbo() returns the right object ? – Nils Rückmann Feb 23 '15 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.