You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.
It would be useful to be able to specify sub-level model namespaces via the sketch area on the Object Model panel.
I know there's a plan to add model namespacing (as per #5) however, on a larger application, I often find it useful to create deeper namespaces.
These defined namespaces could be offset from the base model directory as defined in the FileFactorymodelNamespace setting
As an example, assuming you've defined a model namespace as App\Models and the build would place new models in app/Models then defining a model as Users\Contractor would create a Contractor model in the app\Models\Users directory with the namespace App\Models\Users.
The one issue with this is how you manage relationships, but that could possibly be rectified by adding the ability to specify the model used for a foreign key.
e.g. with something like contractor_id:Users\Contractor
The text was updated successfully, but these errors were encountered:
Hi @Perturbatio, thank you for this idea, love it.
The Users\Contractor approach would be really cool and don't think there would be a problem with foreign keys as the title can be trimmed after the last \to get the foreign key parameter.
Another method that we discussed is something like this: <name> : [extra args,,,,,...]
The namespace example could then be added to the end (optionally) something like this:
Contractor : App\Models\Users
name : text, nullable
email
The last solution is possibly more all around and suitable to be provided by the default "Core package" - but your solution is better for PHP/namespaced languages. Maybe each implementation should have the posibillity to provide its own custom sketch parsing. That would be kind of cool.
If I understand your intention the Contractor in your example is a model with its namespace declared afterwards, I don't think I would have a problem with that, but if I defined the following:
Contractor: App\Models\Users
name
email
Contractor: App\Models\Companies
name
Site
name
contractor_id
How would Site know which contractor is the foreign in this case? My thought was that if I were to do:
Site
name
contractor_id : App\Models\Users\Contractor
I would be implicit about it, maybe I'm not fully understanding your explanation.
It would be useful to be able to specify sub-level model namespaces via the sketch area on the Object Model panel.
I know there's a plan to add model namespacing (as per #5) however, on a larger application, I often find it useful to create deeper namespaces.
These defined namespaces could be offset from the base model directory as defined in the
FileFactory
modelNamespace
settingAs an example, assuming you've defined a model namespace as
App\Models
and the build would place new models inapp/Models
then defining a model asUsers\Contractor
would create aContractor
model in theapp\Models\Users
directory with the namespaceApp\Models\Users
.The one issue with this is how you manage relationships, but that could possibly be rectified by adding the ability to specify the model used for a foreign key.
e.g. with something like
contractor_id:Users\Contractor
The text was updated successfully, but these errors were encountered: