User tests: Successful: Unsuccessful:
[4.0] [com_fields] Error when creating field
Pull Request for Issue #18920 .
getTable method doesn't need name or prefix value to load the correct table class
Attempting to create a field in a fresh install results in "Component\Fields\Administrator\Table\Field' not found"
Field is saved
Error: Component\Fields\Administrator\Table\Field' not found
This restores normal function
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_fields |
Title |
|
Labels |
Added:
?
|
Title |
|
Could you please check to see whether you got this issue with latest 4.0-dev branch? I could not re-procedure the issue and this fix is not correct to me
The only change needed is change the code in this line https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_fields/Model/FieldModel.php#L404 from:
public function getTable($name = 'Field', $prefix = 'FieldsTable', $options = array())
To:
public function getTable($name = 'Field', $prefix = 'Administrator', $options = array())
Even without that change, the table class should still be found because we have code to fallback to Administrator when an invalid $prefix is passed, see https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/Factory/MVCFactory.php#L129
I'm cloning the current 4.0-dev branch now - which is a real pain over satellite.
When I adjust getTable to use Fields and Administrator - I get the same error as before
Class 'Joomla\Component\Fields\Administrator\Table\Field' not found
I looked at that last night (with those values), and trying different combinations while watching the createTable vars in MVCFactory.
I'll try again when the clone is finished.
The class name you mentioned is wrong somehow. If you look at this code https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/Factory/MVCFactory.php#L129, the class name should be Joomla\Component\Fields\Administrator\Table\FieldTable, so it is correct class and should not cause the error
The output of MVCFactory::createTable is Joomla\Component\Fields\Administrator\Table\FieldTable - however, the error shows Joomla\Component\Fields\Administrator\Table\Field
That's what prompted me to try the com_content ArticleTable method - an empty class with the correct name (the name from the error) that extends FieldTable.
If we need blank stub classes then we're doing something wrong. That is the issue that needs to be fixed.
By the way - if I change the getTable input to FieldTable and Administrator - the error changes to: Table FieldTable not supported. File not found.
I don't think I'll be able to test against 4.0-dev in the next 11 minutes. Today is my sons birthday and he gets the whole day - so I'll be back on this tonight.
Sorry I could not see the issue myself, so I could not check it further. Maybe it happens in special condition, hopefully you can find out the root cause of the issue for a proper fix.
If someone can post a backtrace (should be able to get it with debug mode enabled) that'd be helpful.
Call stack
1 () JROOT/administrator/components/com_fields/Table/FieldTable.php:115
2 Joomla\Component\Fields\Administrator\Table\FieldTable->check() JROOT/libraries/src/MVC/Model/AdminModel.php:1167
3 Joomla\CMS\MVC\Model\AdminModel->save() JROOT/administrator/components/com_fields/Model/FieldModel.php:148
4 Joomla\Component\Fields\Administrator\Model\FieldModel->save() JROOT/libraries/src/MVC/Controller/FormController.php:726
5 Joomla\CMS\MVC\Controller\FormController->save() JROOT/libraries/src/MVC/Controller/BaseController.php:710
6 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/Dispatcher.php:165
7 Joomla\CMS\Dispatcher\Dispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:423
8 Joomla\CMS\Component\ComponentHelper::dispatchComponent() JROOT/libraries/src/Component/ComponentHelper.php:364
9 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:106
10 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:149
11 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:340
12 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:35
13 require_once() JROOT/administrator/index.php:30
I still don't have 4.0-dev yet to test - Downloading 4th retry, connection keeps getting terminated. The joys of satellite internet.
So if that trace is right then there's something really wrong.
new static;
shouldn't be instantiating a new instance of that class with a different class name...
Download completed - the issue does not exist in 4.0-dev
Closing this PR - thanks for the guidance @mbabker @joomdonation
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-06 15:04:32 |
Closed_By | ⇒ | stutteringp0et |
Something is wrong with the build configurations - the tests are erroring out on libsodium
Travis-PHP7: configure: error: wrong libsodium lib version (< 1.0.8) or lib not found
Travis-PHP7.1: configure: error: wrong libsodium lib version (< 1.0.8) or lib not found
appveyor-PHP7:
appveyor-PHP7.1:
Someone needs to look into that.