question about namespaces ( regarding Package models)
Permalink
└── presse
├── controllers
│ └── single_page
│ └── dashboard
│ └── presse
│ └── list_view.php
├── models
│ └── core_commerce_presse_list.php
namespace of model class core_commerce_presse_list :
namespace Concrete\Package\Presse\models;
use model class in controller list_view :
use Concrete\Package\Presse\models\CoreCommercePresseList;
Error: In controller list_view the model class is not found
when I placed models folder in controller folder the problem is solved but when I placed models folder inside root directory of package and related namespace and linked in controller this not works.
├── controllers
│ └── single_page
│ └── dashboard
│ └── presse
│ └── list_view.php
├── models
│ └── core_commerce_presse_list.php
namespace of model class core_commerce_presse_list :
namespace Concrete\Package\Presse\models;
use model class in controller list_view :
use Concrete\Package\Presse\models\CoreCommercePresseList;
Error: In controller list_view the model class is not found
when I placed models folder in controller folder the problem is solved but when I placed models folder inside root directory of package and related namespace and linked in controller this not works.
Consider moving your models inside the src folder of your package and then use this documentation article here:https://documentation.concrete5.org/developers/packages/adding-custo... to enable autoloading.
Thanks It Works
Kindly tell me can we use similar method on concrete5 5.7.3 so that when we update
concrete5 5.7.3 to concrete5 8.5.2 we don't need to make any kind of change.
concrete5 5.7.3 to concrete5 8.5.2 we don't need to make any kind of change.
I want to ask about the difference of two concrete5 packages concrete5 5.7.3v and
concrete5 8.5.2.
In concrete5 8.5.2 the models linked with controller with following example
├── src
│ └── entity
│ └── CoreCommercePresseList.php
In root directory of controller i have two functions like below
public function getEntityManagerProvider()
{
$provider = new StandardPackageProvider($this->app, $this, [
'src/Entity/' => '\Presse\Entity'
]);
return $provider;
}
public function on_start()
{
Route::register('/Presse/sortorder', '\Concrete\Package\Presse\Controller\SinglePage\Dashboard\SortTestimonialOrder::SortOrder');
}
The namespace of CoreCommercePresseList.php like below
namespace Presse\Entity;
And this model class access in controller like below
use Presse\Entity\CoreCommercePresseList;
There is no issue it works fine.but the problem is this when I use similar method in
concrete5 5.7.3 this method(use Presse\Entity\CoreCommercePresseList) is not work and I also used model class in controller like following but it also not works.
use Concrete\Package\Presse\Entity\CoreCommercePresseList;
Actually I'm updating concrete5 project to concrete5 5.7.3 and then on concrete5 8.5.2
***kindly tell me a solution which applicable on both concrete5 8.5.2 and concrete5 5.7.3***
concrete5 8.5.2.
In concrete5 8.5.2 the models linked with controller with following example
├── src
│ └── entity
│ └── CoreCommercePresseList.php
In root directory of controller i have two functions like below
public function getEntityManagerProvider()
{
$provider = new StandardPackageProvider($this->app, $this, [
'src/Entity/' => '\Presse\Entity'
]);
return $provider;
}
public function on_start()
{
Route::register('/Presse/sortorder', '\Concrete\Package\Presse\Controller\SinglePage\Dashboard\SortTestimonialOrder::SortOrder');
}
The namespace of CoreCommercePresseList.php like below
namespace Presse\Entity;
And this model class access in controller like below
use Presse\Entity\CoreCommercePresseList;
There is no issue it works fine.but the problem is this when I use similar method in
concrete5 5.7.3 this method(use Presse\Entity\CoreCommercePresseList) is not work and I also used model class in controller like following but it also not works.
use Concrete\Package\Presse\Entity\CoreCommercePresseList;
Actually I'm updating concrete5 project to concrete5 5.7.3 and then on concrete5 8.5.2
***kindly tell me a solution which applicable on both concrete5 8.5.2 and concrete5 5.7.3***
What version are you starting from? ie, why is it necessary to go via c5.7.3?
If you are upgrading from an early 5.7 version, it may be feasible to run the essential version upgrade steps from the cli without running the site on the way, so dodging the quirks of namespaces prior to arriving at 8.5.2. That would be a potentially high risk strategy, especially for corrupting attributes, but it may actually work and save the pain of making namespaces transiently compatible with various intermediate core versions.
Namespace resolution changed in big ways before v8
- Some conventions for namespace resolution in 5.7 were found to be ambiguous, so they got removed
- New interfaces added for declaring package specific namespaces.
There are some notes about 'Legacy' early 5.7 namespaces athttps://documentation.concrete5.org/developers/appendix/autoloading-...
https://documentation.concrete5.org/developers/appendix/adding-custo...
There are also some big fudges made to allow v8 to run packages that conform to the early 5.7 namespaces.
If you are upgrading from an early 5.7 version, it may be feasible to run the essential version upgrade steps from the cli without running the site on the way, so dodging the quirks of namespaces prior to arriving at 8.5.2. That would be a potentially high risk strategy, especially for corrupting attributes, but it may actually work and save the pain of making namespaces transiently compatible with various intermediate core versions.
Namespace resolution changed in big ways before v8
- Some conventions for namespace resolution in 5.7 were found to be ambiguous, so they got removed
- New interfaces added for declaring package specific namespaces.
There are some notes about 'Legacy' early 5.7 namespaces athttps://documentation.concrete5.org/developers/appendix/autoloading-...
https://documentation.concrete5.org/developers/appendix/adding-custo...
There are also some big fudges made to allow v8 to run packages that conform to the early 5.7 namespaces.
First of all Thanks for reply!
Actually our websites built in concrete5.6 but we want to upgrade it on concrete8.5.2 but regarding concrete5 documentation we cann't done it directly we have to upgrade our web first from concrete5.6 to concrete5.7.3 then on concrete8.5.2 .
Actually our websites built in concrete5.6 but we want to upgrade it on concrete8.5.2 but regarding concrete5 documentation we cann't done it directly we have to upgrade our web first from concrete5.6 to concrete5.7.3 then on concrete8.5.2 .
You can't upgrade from 5.6. The step from 5.6 to 5.7 is incompatible. The best you can do is export some content and import to latest v8.5.2.
With that in mind, the best route is to start with a fresh install of v8.5.2 and forget all the time you are wasting on an upgrade path that does not exist.
You will effectively be building a new site, with an import of some content exported from the old site. 5.6 addons are not compatible, so you will also need to pick a new suite of addons. For example, Community Store.
With that in mind, the best route is to start with a fresh install of v8.5.2 and forget all the time you are wasting on an upgrade path that does not exist.
You will effectively be building a new site, with an import of some content exported from the old site. 5.6 addons are not compatible, so you will also need to pick a new suite of addons. For example, Community Store.
If you do decide to export content from your 5.6 site, please be aware that the legacy export addon requires 5.6.4.0 to be installed, so if your version is less than this you must upgrade to 5.6.4.0 first.
https://github.com/concrete5/addon_migration_tool_legacy...
Personally I would not use the export method, your time would be better spent installing a brand new site on 8.5.2
https://github.com/concrete5/addon_migration_tool_legacy...
Personally I would not use the export method, your time would be better spent installing a brand new site on 8.5.2