EntityDefs and links
Collapse
X
-
Hi
In Article you should have:
In ArticleControlPHP Code:"controls": { "type": "hasMany", "entity": "ArticleControl", "foreign": "article" }
PHP Code:"article": { "type": "belongsTo", "entity": "Article", "foreign": "controls" }Leave a comment:
-
EntityDefs and links
Hi, I'm having some problems with my custom module, I have 2 entities: Article and ArticleControl with this definitions:
Article:
ArticleControl:PHP Code:{ "fields": { "name": { "type": "varchar", "required": true }, "createdAt": { "type": "datetime", "readOnly": true }, "modifiedAt": { "type": "datetime", "readOnly": true }, "createdBy": { "type": "link", "readOnly": true }, "modifiedBy": { "type": "link", "readOnly": true }, "assignedUser": { "type": "link", "required": true }, "teams": { "type": "linkMultiple" } }, "links": { "createdBy": { "type": "belongsTo", "entity": "User" }, "modifiedBy": { "type": "belongsTo", "entity": "User" }, "assignedUser": { "type": "belongsTo", "entity": "User" }, "teams": { "type": "hasMany", "entity": "Team", "relationName": "EntityTeam" }, "tasks": { "type": "belongsTo", "entity": "Task" }, "control": { "type": "hasChildren", "entity": "ArticleControl", "foreign": "parent" } }, "collection": { "sortBy": "name", "asc": false, "boolFilters": ["onlyMy"] } }
PHP Code:{ "fields": { "data": { "type": "text" }, "status": { "type": "enum", "options": ["Pending", "Completed"], "default": "Pending" }, "createdAt": { "type": "datetime", "readOnly": true } }, "links": { "control": { "type": "belongsTo", "entity": "Article" } }, "collection": { "sortBy": "createdAt", "asc": false } }
The issue is when I call /Article/%ID%/control I always get all the items instead of the items connected. What I'm missing?
ThanksLast edited by caffeine; 09-28-2014, 07:34 PM.Tags: None

Leave a comment: