i develope a component and create a installation file named script.php.
this are the first lines of the file:
class com_sportsmanagementInstallerScript
{
/**
* Constructor
*
* @param JAdapterInstance $adapter The object responsible for running this script
*/
public function __construct(JAdapterInstance $adapter)
{
$this->release = $adapter->get( "manifest" )->version;
}
if i install the component, i got this error:
An error has occurred.
0 Argument 1 passed to com_sportsmanagementInstallerScript::__construct() must be an instance of JAdapterInstance, instance of Joomla\CMS\Installer\Adapter\ComponentAdapter given, called in /www/htdocs/w0086dfc/joomla40/libraries/src/CMS/Installer/InstallerAdapter.php on line 1006
what am i doing wrong ?
Extension adapters no longer extend from
JAdapterInstance
in 4.0 as noted at https://api.joomla.org/cms-3/classes/Joomla.CMS.Installer.InstallerAdapter.htmlYou should typehint
JInstallerAdapter
(for support from 3.4 to present) orJoomla\CMS\Installer\InstallerAdapter
(for support from 3.8 to present).