Commands im Add-on nutzen
-
Hallo zusammen,
ich versuche, einen Console-Command in einem Add-on zu implementieren, stoße dabei jedoch auf ein Problem mit den Klassen.
In der Command-Klasse (rot markiert) versuche ich, auf eine Methode der Manager-Klasse (grün markiert) zuzugreifen. Beim Ausführen des Befehls
php console.php tools:sync
erhalte ich jedoch die unten stehende Fehlermeldung.Offenbar ist es mir aktuell nicht möglich, auf eine Klasse außerhalb zuzugreifen. In der GUI sind die Klassen jedoch erreichbar.
Könnte mir bitte jemand dabei helfen oder einen Hinweis geben, woran das liegen könnte?
Vielen Dank im Voraus!
Cherif
PHP Fatal error: Uncaught Error: Class "idoit\Module\tools\Manager\MyManager" not found in /var/www/i-doit/src/classes/modules/tools/src/Console/Command/MyCommand.php:88
Stack trace:
#0 /var/www/i-doit/vendor/symfony/console/Command/Command.php(326): idoit\Module\tools\Console\Command\MyCommand->execute()
#1 /var/www/i-doit/vendor/symfony/console/Application.php(1088): Symfony\Component\Console\Command\Command->run()
#2 /var/www/i-doit/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#3 /var/www/i-doit/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#4 /var/www/i-doit/console.php(26): Symfony\Component\Console\Application->run()
#5 {main}in init.php
Psr4AutoloaderClass::factory() ->addNamespace('idoit\Module\tools', DIR . '/src/');in der MyCommand.php:
namespace idoit\Module\tools\Console\Command;use idoit\Console\Command\AbstractCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use idoit\Module\tools\Manager\MyManager;class MyCommand extends AbstractCommand
{
...in der MyManager.php
namespace idoit\Module\tools\Manager;use Exception;
use isys_application;
use isys_component_dao_result;
use isys_exception_dao;
use isys_exception_database;
use isys_cmdb_dao;class MyManager extends isys_cmdb_dao
{
...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login