I write a small component to export data from a shop component, this is my first component, i get the error "Fatal error: Call to a member function getKeyName() on a non-object PATH\legacy\model\admin.php on line 885", i found some solution, but my problem is i don't wont new table, and my question is how can i avoid new sql table? Because i work with tables of already existing components and they are not edited with my component.

My sources:


I understand from this solution that i need a new table, but i don't need it...

  • Please can you show us some code?
    – Lodder
    Commented Oct 25, 2014 at 9:32
  • Here is my model file: pastebin.com/6HG7qvDS, and my form file is: pastebin.com/U51WT5Xs
    – jExchange
    Commented Oct 25, 2014 at 9:49
  • Your pastes disappeared. Also are you perhaps using something other then JModelLegacy? If its list or item I think it "assumes" there is a table attached. Commented Oct 25, 2014 at 11:18
  • @JordanRamstad no, i use JModelAdmin, i published files again: pastebin.com/Ev3P9f3v & pastebin.com/w18EbFPj
    – jExchange
    Commented Oct 25, 2014 at 18:46
  • What function is running for line 885 of legacy/model/admin.php? I'm guessing that is the save method, which then raises the question, how are you saving date if not to a table?! Commented Oct 26, 2014 at 3:18

2 Answers 2


JForm usually maps to the columns of a database table when used with JModelAdmin, so if the name of a column is add it looks for add to be a column in that table.

If you look into the content component (articles) and inspect some of the form fields, then look at the database table for content you will see their names match. If you want to use JForm the best way is to apply your own logic to it, so use JModelLegacy with a controller to catch and direct save to your own model function, rather then the default.

For pretty much every function in JModelAdmin it adds $table = $this->getTable(); to be able to pass or retrieve the data from the table. However with JModelLegacy there is no direct connection to JForm but by the sounds of it you just want the clean way to display the forms, so it is probably best to just add that logic to your view class anyway (the view.html.php)

However you could override the save/retrieve functions of JModelAdmin to make use of it, but all in all it might be more work then just using JModelLegacy in my opinion. It forces less on you and gives you the ability to customize your code more if you are not using the typical Joomla way of using tables.


I copyed the model-file from another component. Than i renamed the important places in the file. In my case, i forgot to change the the prefix value in the function getTable. Hope this helps.

  • Welcome to JSE and thank you for taking your first syep as a contributor. However, I don't find your answer to be tailored to the OP's question. It seems that you are expressing how you solved your own issue which may have overlapping details with this question. When you answer a question please be very careful to precisely answer the question which is described in the question. Commented Jan 8, 2021 at 13:07
  • Please take our tour and read How to Answer. If you don't mind, please introduce yourself and tell us about your Joomla experience by editing your profile. Commented Jan 8, 2021 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.