4spacesdk/CI4OrmExtension

Wrong namesapce?

Closed this issue · 3 comments

Hello, given the following mapping in config when I try to save a relation I get the wrong path.
public static $modelNamespace = [ 'Module\Menu\Models\\' ];
If I do a dump in getRelations from ModelDefinitionCache for $modelNamespace I get my config namespace + the full entity namespace + it adds Model at the end resulting in this:
Module\Menu\Models\Module\Menu\Models\MenuItemModel
In my Item Model my relation is like this.
public $hasOne = [ MenuModel::class ];
Any ideas what I did wrong ...

I don't think you did anything wrong.
I've never used other namespaces than the default ones App\Models and App\Entities.
The code is based on these configurations. But never actually testet with different namespaces. So there is probably an error somewhere.
I'll take a look at it at some point. Can't promise when. But in this week I hope.
You can also try to find the error yourself and create a PR.

@bogdaniel
I've tried to reproduce your issue but without any luck.
If you check out this repository, https://github.com/4spacesdk/CI4-RestOrmExtensionSample, you will see how I use models and entities with different namespaces.
Can you reproduce your situation in a fork of this repository?

Hello,
When i get some free time i'll do a repo test and post it here to see what's wrong. From my point of view it shouldn't have any issues but again i have a bunch of libraries used in the project and i tried to implement your library everywhere. :-)