Updating v7 Packages to v8
Permalink
I have a few v7 packages that I'm attempting to get working with v8.
The installation/upgrade functionality is quite a large chunk of code and I would like to place it in a second file. But I cannot figure out how to autoload that file. I've tried every permutation of namespace I can think of, but no joy.
I can 'require' the file that I need and all works according to plan. But requiring a file isn't kosher with the automated checks that the marketplace has.
Has the namespace scheme changed in v8?
It used to be that
mapped to
which would mean I would use
to reference this file
Suggestions?
The installation/upgrade functionality is quite a large chunk of code and I would like to place it in a second file. But I cannot figure out how to autoload that file. I've tried every permutation of namespace I can think of, but no joy.
I can 'require' the file that I need and all works according to plan. But requiring a file isn't kosher with the automated checks that the marketplace has.
Has the namespace scheme changed in v8?
It used to be that
Concrete\Package\MyPackageName\Src
mapped to
{root}/packages/my_package_name/src
which would mean I would use
use Concrete\Package\MyPackageName\Src\Installer
to reference this file
{root}/packages/my_package_name/src/installer.php
Suggestions?
Not on my PC right now, so I can't check.. but have you tried Installer.php with an uppercased "i"?
Yes, sorry that's what I have and meant:
{root}/packages/my_package_name/src/Installer.php
Do you then have in the Installer.php file the namespace and class name of:
?
Normally I've put classes within further folders, pretty much /src/PackageName/Topic/Whatever.php, but I think that's a PSR-0 thing and no longer required (still helps to organise though I think, someone might be able explain it better)
----
EDIT - I don't believe the namespacing has changed in v8, my add-ons that use the src folder are working as expected in that regard
<?php namespace Concrete\Package\MyPackageName\Src; class Installer {
?
Normally I've put classes within further folders, pretty much /src/PackageName/Topic/Whatever.php, but I think that's a PSR-0 thing and no longer required (still helps to organise though I think, someone might be able explain it better)
----
EDIT - I don't believe the namespacing has changed in v8, my add-ons that use the src folder are working as expected in that regard
I had some weirdness using classes within my packages before they were installed that I assumed were a chicken & egg problem, that the namespace didn't exist until after my package was installed, so couldn't be used during the installation. I got round it by doing app->make(package's own installer utility class) in the package controller install method as I only needed the one instance. Seems to work on OK installing on v8.