Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent/Child modResource JSON seed data issue. #39

Open
zaigham opened this issue Jun 30, 2015 · 5 comments
Open

Parent/Child modResource JSON seed data issue. #39

zaigham opened this issue Jun 30, 2015 · 5 comments

Comments

@zaigham
Copy link
Contributor

zaigham commented Jun 30, 2015

As per twitter conversation: https://twitter.com/craftsmancoding/status/615949782897463296

The following dataset only created parent page. and thats it.
Please see the data sample below:

[
    {
        "type": "document",
        "contentType": "text/html",
        "pagetitle": "Parent Page",
        "longtitle": "",
        "description": "",
        "alias": "s",
        "link_attributes": "",
        "published": true,
        "pub_date": 0,
        "unpub_date": 0,
        "parent": 0,
        "isfolder": true,
        "introtext": "",
        "content": "Some Content",
        "richtext": false,
        "template": 0,
        "menuindex": 8,
        "searchable": false,
        "cacheable": false,
        "createdby": 39,
        "createdon": "2013-12-10 23:02:37",
        "editedby": 900,
        "editedon": "2015-03-23 18:06:46",
        "deleted": false,
        "deletedon": 0,
        "deletedby": 0,
        "publishedon": "2013-12-10 23:07:00",
        "publishedby": 39,
        "menutitle": "",
        "donthit": false,
        "privateweb": false,
        "privatemgr": false,
        "content_dispo": 0,
        "hidemenu": true,
        "class_key": "modDocument",
        "context_key": "web",
        "content_type": 1,
        "uri": "s/",
        "uri_override": 0,
        "hide_children_in_tree": 0,
        "show_in_tree": 1,
        "properties": null,
        "children": {
            "type": "document",
            "contentType": "text/html",
            "pagetitle": "Child of Parent Page",
            "longtitle": "",
            "description": "",
            "alias": "product",
            "link_attributes": "",
            "published": true,
            "pub_date": 0,
            "unpub_date": 0,
            "isfolder": false,
            "introtext": "",
            "content": "Some Content",
            "richtext": false,
            "template": 0,
            "menuindex": 6,
            "searchable": false,
            "cacheable": true,
            "createdby": 39,
            "createdon": "2013-12-16 12:51:59",
            "editedby": 39,
            "editedon": "2015-03-26 19:45:47",
            "deleted": false,
            "deletedon": 0,
            "deletedby": 0,
            "publishedon": "2013-12-16 14:02:00",
            "publishedby": 39,
            "menutitle": "",
            "donthit": false,
            "privateweb": false,
            "privatemgr": false,
            "content_dispo": 0,
            "hidemenu": true,
            "class_key": "modDocument",
            "context_key": "web",
            "content_type": 1,
            "uri": "s/profile",
            "uri_override": 1,
            "hide_children_in_tree": 0,
            "show_in_tree": 1,
            "properties": null
        }
    }
]
@fireproofsocks
Copy link
Member

Case matters for aliases: it must be "Children" -- use the graph function to help identify the aliases available.

@zaigham
Copy link
Contributor Author

zaigham commented Jun 30, 2015

I just fixed the case, and ran seed command. I got this error:

ERROR:  build_attributes not set for modResource-->Children in composer.json. Make sure your definitions include "related_objects" and "related_object_attributes"

Would you please shed some light on this?

@fireproofsocks
Copy link
Member

For each object, you need to describe its behavior when it comes to primary key, creates vs. updates, etc. This is done via the build_attributes. E.g. look at https://github.com/craftsmancoding/repoman/wiki/composer.json

So you could include something like the following in your "extra" --> "build_attributes" node in your composer.json:

"build_attributes":{
    "modResource": {
        "preserve_keys": true,
        "update_object": true, 
        "unique_key": ["alias"],
        "related_objects": true,
        "related_object_attributes": {  
            "Children": {
                "preserve_keys":        
                "update_object": true, 
                "unique_key": ["alias"]
            }
        }
    }
}

@zaigham
Copy link
Contributor Author

zaigham commented Jul 1, 2015

I have tried this, still couldnt get the children docs in there. The data is same as above json.

This is my buid_attributes section:

"build_attributes":{
            "modResource": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": ["alias"],
                "related_objects": true,
                "related_object_attributes": {  
                    "Children": {
                        "preserve_keys": true,
                        "update_object": true, 
                        "unique_key": ["alias"]
                    }
                }
            }
        }

@fireproofsocks
Copy link
Member

Hmm... I'll have to troubleshoot and write up a tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants