Is it possible to put Entity inside of a nested folder/package and still use CRUD module for basic administration?
I’m using YABE app, playframework 1.2.4.
I created another Entity called “Page” and I tried to put it in subfolder called “cms” in all folders like this:
models
-- cms
-- Page.java
etc.
Existing link for YABE Entities is created like this:
<a href="@{Users.list()}">Users</a>
which generates route admin/users and leads you to a CRUD generated page
but if you put something like this, e.g. also create controller inside nested folder:
<a href="@{cms.Pages.list()}">Pages</a>
generates link like this cms.pages/list and leads you to “Not found“
Even if I put controller in a controllers root folder doesn’t work, obviously because CRUD module can’t find model class because it’s in subfolder.
When Page related classes are in root of controllers and models, everything works fine, but I want something like “packages” here.
What am I doing wrong?
Is something like this possible?
Will it work if I move everything to a separate module?
It is possible. However I found that keeping the CRUD models for entities in a different package made things a little more complicated and did not add that much value.
Anyway make sure your controllers use the @CRUD.for annotation so they know which entity to manage:
If you need to place your views in a subpackage, play crud:ov –template cms/Users/list will not work as expected except if you hack the crud commands.py with something like:
I can’t remember for sure but I think you might need to redefine your routing rules with something like: