J2.5 talk:Developing a MVC Component/Adding categories
From Joomla! Documentation
(Difference between revisions)
(New page: Why $query = new JDatabaseQuery; but not $query = &new JDatabaseQuery; ?) |
|||
| Line 1: | Line 1: | ||
Why $query = new JDatabaseQuery; | Why $query = new JDatabaseQuery; | ||
but not $query = &new JDatabaseQuery; ? | but not $query = &new JDatabaseQuery; ? | ||
| + | |||
| + | In ../models/fields/helloworld.php on line 29 | ||
| + | |||
| + | If you use the line, $query = new JDatabaseQuery;, component works, but when helloworlds is added as menu item it causes the following error when item is clicked: | ||
| + | |||
| + | Fatal error: Cannot instantiate abstract class JDatabaseQuery in C:\xampp\htdocs\test_site\administrator\components\com_helloworld\models\fields\helloworld.php on line 29 | ||
| + | |||
| + | Reverting back to code from part 11, $query = $db->getQuery(true);, does not throw error. | ||
| + | |||
| + | Just an observation. | ||
Revision as of 07:05, 4 August 2011
Why $query = new JDatabaseQuery; but not $query = &new JDatabaseQuery; ?
In ../models/fields/helloworld.php on line 29
If you use the line, $query = new JDatabaseQuery;, component works, but when helloworlds is added as menu item it causes the following error when item is clicked:
Fatal error: Cannot instantiate abstract class JDatabaseQuery in C:\xampp\htdocs\test_site\administrator\components\com_helloworld\models\fields\helloworld.php on line 29
Reverting back to code from part 11, $query = $db->getQuery(true);, does not throw error.
Just an observation.