Fatal error: Call to undefined method JException::getQuery()

alanstylez

Member
( ! ) Fatal error: Call to undefined method JException::getQuery() in /mnt/data/vhosts/nuvacord.net/httpdocs/administrator/components/com_fabrik/models/lists.php on line 47
Call Stack
# Time Memory Function Location
1 0.0003 667256 {main}( ) ../index.php:0
2 0.6329 3054008 JAdministrator->dispatch( ) ../index.php:47
3 0.6403 3955144 JComponentHelper::renderComponent( ) ../application.php:154
4 3.4279 4222088 require_once( '/mnt/data/vhosts/nuvacord.net/httpdocs/administrator/components/com_fabrik/fabrik.php' ) ../helper.php:152
5 3.6206 8688288 JController->execute( ) ../fabrik.php:32
6 3.6206 8688368 FabrikController->display( ) ../controller.php:649
7 3.6206 8688448 JController->display( ) ../controller.php:30
8 25.1211 9451056 FabrikViewLists->display( ) ../controller.php:616
9 25.1211 9451184 JView->get( ) ../view.html.php:38
10 25.1211 9451360 JModelList->getItems( ) ../view.php:365
11 25.1218 9452712 JModelList->_getListQuery( ) ../modellist.php:104
12 25.1218 9452920 FabrikModelLists->getListQuery( ) ../modellist.php:81



The above error seems to be coming from the following code:


protected function getListQuery()
{
// Initialise variables.
$db = $this->getDbo();
$query = $db->getQuery(true);

// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'l.*'
)
);
$query->from('`#__{package}_lists` AS l');

// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('l.published = '.(int)$published);
} else if ($published === '') {
$query->where('(l.published IN (0, 1))');
}

//Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
$search = $db->Quote('%'.$db->getEscaped($search, true).'%');
$query->where('(l.db_table_name LIKE '.$search.' OR l.label LIKE '.$search.')');
}

// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'ordering' || $orderCol == 'category_title') {
$orderCol = 'category_title '.$orderDirn.', ordering';
}
if (trim($orderCol) !== '') {
$query->order($db->getEscaped($orderCol.' '.$orderDirn));
}

return $query;
}

/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
* @return string A store id.
* @since 1.6
*/



How do I fix it?

stylez
 
Is $this the solution (pun intended)?

// Initialise variables.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
 
I can't replicate the bug. If you are using the svn, can you ensure you updated all files?

-Rob
 
I updated the file structure with the latest release from the SVN and still no go. But, after poking around a bit, it seems that the jos_fabrik_connections table did not fill correctly, so it wasn't connecting to the database (hense the error @ $db, I assume).

Now I'm having a problem that may be related: In attempting to create a new 'List', the 'data' tab is completely empty, even after changing 'table_id' to 'list_id' in 'jos-fabrik_joins'. I find it suspicious that the other 3 variables in the table are still called 'table_join', 'table_key', and 'table_join_key'. So, which is supposed to be a table and which is supposed to be a list?
 
hi

Those field names look correct to me. Its list_id as that refers to a list. I'd not thought about the others to be honest but as they refer to a db table, I think we can leave them as they are for now. (Its always a big hassle changing field names)

Is your connection set to default (perhaps that's the issue?)
I know that previously there was an issue with the data tab being empty but that was fixed some time ago.
 
Yes, the connection is set to default, although I had to migrate this manually after problems with the install. Is the following entry correct:

id int(6) 1
host varchar(255) *.com
user varchar(255) *
password varchar(255) *
database varchar(255) psdbncj163
description varchar(255) psdbncj163
published int(1) 1
checked_out int(4) 0
checked_out_time datetime 0000-00-00 00:00:00
default int(1) 1
params text


Or, does the description have to be 'site database' or something?

What was the fix for the data tab being empty some time ago?
 
structure looks ok, we haven't changed that in fabrik 3

descripton can be what ever you like

Can't remember what the fix was - its been in the svn for several months. As I said in the other thread, PM me the info and I'll take a look

-Rob
 
I found a clue:

I installed pkg_fabrik_3 pre-alpha2.zip on another J1.6.3 site and the database tab loads properly. I checked the connections and there is a difference in the 7th variable. In the site that correctly loads, the field is titled 'State' while in the one that does not properly load, the field is titled 'JGLOBAL_STATE'. They are both set to 'Yes'.

Does that help?
 
no not really thats just a translation issue. Can you PM the info I asked for then I'll take a look at the code

Cheers
Rob
 
ok got you PM's (its always best to reply in the thread that you've sent them as thats pretty much the only time I look at my PM messages)

You don't say which page you are getting the error on, so its hard to debug!

Also even though I have turned up error reporting to max in Joomla's global config - I often see blank pages, so I presume you have you php set up not to display errors, could you fix that please as its pretty impossible to test things when I can't see the error generated.

Thanks!
Rob
 
ok got you PM's (its always best to reply in the thread that you've sent them as thats pretty much the only time I look at my PM messages)

You don't say which page you are getting the error on, so its hard to debug!

Also even though I have turned up error reporting to max in Joomla's global config - I often see blank pages, so I presume you have you php set up not to display errors, could you fix that please as its pretty impossible to test things when I can't see the error generated.

Also things seem fairly odd in you site. You don't have a single element plugin published. (You should go to extensions->plugin manager and filter by type = 'fabrik_element' and publish the element plugins you want to use)

I've added a notice to the code so that when this situation occurs you at least know you have to fix it.

Then all the elements you have are listed with the old fabrik2 plugin names. E.g if you go to components->fabrik->elements and look at the plugin column you have plugins listed as 'fabriktextarea', but in Fabrik 3 those are called 'textarea'

Could you describe how you created the tables?

Thanks!
Rob
 
You're right (again)! I've been importing all my 'tables' from Fabrik2. Can you please describe the changes that need to be done manually in order for them to read and write effectively?
 
There was no upgrade option available. I've done a diff on the two database files and have come up with the following sql

First back up your tables! I've not tested this!

Also note that all your radiobutton/database join/dropdown sub values will be removed when you run this query so you will need to re-apply them

Code:
UPDATE `#__fabrik_elements` set plugin = (SELECT replace(plugin,'fabrik', ''));
ALTER TABLE `#__fabrik_connections` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_connections` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_cron` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_cron` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_elements` CHANGE `show_in_table_summary` `show_in_list_summary`;
ALTER TABLE `#__fabrik_elements` DROP `can_order`;
ALTER TABLE `#__fabrik_elements` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_elements` DROP `button_javascript`;
ALTER TABLE `#__fabrik_elements` DROP `sub_values`;
ALTER TABLE `#__fabrik_elements` DROP `sub_labels`;
ALTER TABLE `#__fabrik_elements` DROP `sub_initial_selection`;
ALTER TABLE `#__fabrik_elements` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_forms` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_forms` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_groups` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_groups` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_joins` CHANGE `table_id` `list_id` INT( 6 ) NOT NULL;
ALTER TABLE `#__fabrik_joins` CHANGE `attribs` `params`; 
ALTER TABLE `#__fabrik_jsactions` CHANGE `attribs` `params`;
RENAME TABLE `#__fabrik_tables` TO `#__fabrik_lists`;
ALTER TABLE `#__fabrik_lists` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_lists` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_log` ADD `flag` SMALLINT(3) NOT NULL;
ALTER TABLE `#__fabrik_log` ADD `message_source` VARCHAR(255) NOT NULL;
ALTER TABLE `#__fabrik_packages` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_packages` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_packages` ADD `component_name` VARCHAR(100) NOT NULL;
ALTER TABLE `#__fabrik_packages` ADD `version` VARCHAR(10) NOT NULL;
ALTER TABLE `#__fabrik_packages` DROP `tables`;
ALTER TABLE `#__fabrik_validations` CHANGE `clent_side_validation` `client_side_validation`;
ALTER TABLE `#__fabrik_validations` CHANGE `attribs` `params`;
ALTER TABLE `#__fabrik_visualizations` CHANGE `state` `published`;
ALTER TABLE `#__fabrik_visualizations` CHANGE `attribs` `params`;

replace '#__' with your database prefix e.g. 'jos_'
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top