New selfmade extension install - Not found class
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- Wall0fDeath
- Posts: 28
- Joined: 30 Aug 2022, 13:56
New selfmade extension install - Not found class
"name": "aimeos/ai-laravel",
"version": "2022.10.4",
"name": "aimeos/aimeos-core",
"version": "2022.10.8",
"laravel/framework": "<9.37.0"
"php:":"8.2"
"opsys": "Ubuntu 20.04"
Hi!
I’m trying to create a new aimeos extension with a new datadomain, but I got stuck at the install.
I’ve created and downloaded my zip archive from the aimeos webpage (https://aimeos.org/extensions).
Then I followed this documentation (https://aimeos.org/docs/latest/developer/extensions/ and https://aimeos.org/docs/latest/infrastr ... igrations/).
I created a schema file ("setup/default/schema/return.php") and an Upscheme setup task file ("setup/Return.php"). The Upscheme file and the class name in it are the same, the composer require and update functions worked without error and they can find the extension and it will make the symbolic link to the vendor/aimeos-extensions/ext_name folder.
But, when I try to use php artisan aimeos:setup, I get an error message: Class "\Aimeos\Upscheme\Task\Return" not found. It can’t find my new and fresh class. (and it shows the content of the Upscheme file in the error message…). I’ve tried to make it with simple copy (symbolic link = false), tried to install it from ./packages/ext_name. They all seems to copy the fájl contents to the vendor, but I get the same error message every time I try to use aimeos:setup. As I read it, it should discover the class automatically from the names through association. ( The old names were ReturnProduct.php, ReturnProduct as class name, and return-product.php for scheme for the first attempt, that didn't work either, than I've tried to make it to a single word, to be sure to close out that error possibility.)
Would you help me please in what did I do wrong?
Commands: ( the package is only exists locally on my virtual machine )
Error msg:
"version": "2022.10.4",
"name": "aimeos/aimeos-core",
"version": "2022.10.8",
"laravel/framework": "<9.37.0"
"php:":"8.2"
"opsys": "Ubuntu 20.04"
Hi!
I’m trying to create a new aimeos extension with a new datadomain, but I got stuck at the install.
I’ve created and downloaded my zip archive from the aimeos webpage (https://aimeos.org/extensions).
Then I followed this documentation (https://aimeos.org/docs/latest/developer/extensions/ and https://aimeos.org/docs/latest/infrastr ... igrations/).
I created a schema file ("setup/default/schema/return.php") and an Upscheme setup task file ("setup/Return.php"). The Upscheme file and the class name in it are the same, the composer require and update functions worked without error and they can find the extension and it will make the symbolic link to the vendor/aimeos-extensions/ext_name folder.
But, when I try to use php artisan aimeos:setup, I get an error message: Class "\Aimeos\Upscheme\Task\Return" not found. It can’t find my new and fresh class. (and it shows the content of the Upscheme file in the error message…). I’ve tried to make it with simple copy (symbolic link = false), tried to install it from ./packages/ext_name. They all seems to copy the fájl contents to the vendor, but I get the same error message every time I try to use aimeos:setup. As I read it, it should discover the class automatically from the names through association. ( The old names were ReturnProduct.php, ReturnProduct as class name, and return-product.php for scheme for the first attempt, that didn't work either, than I've tried to make it to a single word, to be sure to close out that error possibility.)
Would you help me please in what did I do wrong?
Commands: ( the package is only exists locally on my virtual machine )
Code: Select all
composer req aimeos-extensions/return-product=@dev;
composer up;
composer dump-autoload;
php artisan aimeos:setup
Code: Select all
namespace Aimeos\Upscheme\Task;
use Aimeos\Upscheme\Schema\Table;
class Return extends Base
{
public function up()
{
$this->info( 'Creating Return product schema', 'vv' );
// Use db connection defined in .env
$db = $this->db( 'db-return' );
foreach( $this->paths( 'default/schema/return.php' ) as $filepath )
{
if( ( $list = include( $filepath ) ) === false ) {
throw new \RuntimeException( sprintf( 'Unable to get schema from file "%1$s"', $filepath ) );
}
foreach( $list['table'] ?? [] as $name => $fcn ) {
$db->table( $name, $fcn );
}
}
}
}
Code: Select all
RuntimeException
Class "\Aimeos\Upscheme\Task\Return" not found
at vendor/aimeos/upscheme/src/Up.php:269
265▕ $taskname = substr( $item->getFilename(), 0, -4 );
266▕ $classname = '\Aimeos\Upscheme\Task\\' . $taskname;
267▕
268▕ if( class_exists( $classname ) === false ) {
➜ 269▕ throw new \RuntimeException( sprintf( 'Class "%1$s" not found', $classname ) );
270▕ }
271▕
272▕ $interface = \Aimeos\Upscheme\Task\Iface::class;
273▕ $task = ( $fcn = static::macro( 'createTask' ) ) ? $fcn( $classname ) : new $classname( $this );
+16 vendor frames
17 artisan:35
Illuminate\Foundation\Console\Kernel::handle()
Re: New selfmade extension install - Not found class
Just a thought because it's not in your posted Return.php file:
Did you forgot the "<?php" at the beginning of the file?
Did you forgot the "<?php" at the beginning of the file?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- Wall0fDeath
- Posts: 28
- Joined: 30 Aug 2022, 13:56
Re: New selfmade extension install - Not found class
I would die from embarrassment now, but yes. After a big pacepalm I checked it, and that was the problem.
Thank your for pointing it out.
Thank your for pointing it out.