You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use Nette Database 3.1.1 in Symfony 5.2.3. My PHP version is 8.0.
When I try to create a database connection in a command I get the following error.
"The autoloader expected class "Nette\Database\IConventions" to be defined in file "/var/www/html/vendor/composer/../nette/database/src/compatibility-intf.php". The file was found but the class was not in it, the class name or namespace probably has a typo."
Steps To Reproduce
Create a Symfony project
Create a command
Try to use Connection like in the following code
<?phpdeclare(strict_types=1);
namespaceApp\Command;
useNette\Database\Connection;
useSymfony\Component\Console\Command\Command;
useSymfony\Component\Console\Input\InputInterface;
useSymfony\Component\Console\Output\OutputInterface;
useSymfony\Component\Console\Style\SymfonyStyle;
classTestCommandextendsCommand
{
protectedstatic$defaultName = 'app:test';
protectedstatic$defaultDescription = 'Add a short description for your command';
protectedfunctionconfigure()
{
$this->setDescription(self::$defaultDescription);
}
protectedfunctionexecute(InputInterface$input, OutputInterface$output): int
{
$io = newSymfonyStyle($input, $output);
$database = newConnection(
'mysql:host=127.0.0.1;dbname=test',
'test',
'xxx'
);
returnCommand::SUCCESS;
}
}
Version: 3.1.1
Bug Description
I would like to use Nette Database 3.1.1 in Symfony 5.2.3. My PHP version is 8.0.
When I try to create a database connection in a command I get the following error.
"The autoloader expected class "Nette\Database\IConventions" to be defined in file "/var/www/html/vendor/composer/../nette/database/src/compatibility-intf.php". The file was found but the class was not in it, the class name or namespace probably has a typo."
Steps To Reproduce
Possible Solution
As suggested on StackOverflow (https://stackoverflow.com/questions/66458897/nette-database-not-working-in-symfony-5-2-command) the IConventions alias in "compatibility-intf.php" should be created when the IConventions class does not exist, not when the ISupplementalDriver class does not exits.
So instead of
it should be
The text was updated successfully, but these errors were encountered: