Closed remixlearning closed 9 years ago
Yes: that's one of the tutorials I would like to write before releasing this publicly. Resources are difficult because so often you rely on the page IDs -- they are the only object in MODX that use the ids like that (e.g. for links), but the id is only a side-effect of the database where it's installed. So be careful if you have to link between pages.
All Repoman objects other than Elements are stored as Seed Data -- see https://github.com/craftsmancoding/repoman/wiki/Seed-Data
That means that to create an object, you must create a file that returns an array that represents that object. To know which attributes each object might have, there is the "graph" tool, e.g. "php repoman graph modChunk" -- it prints out all available attributes and also all available relations. The relations are usually optional unless you need to have the 2 objects related -- MODX handles the foreign key relations. For example, look at the related objects of modMenu and modAction that are linked when you create a CMP: https://github.com/craftsmancoding/repoman/wiki/Sample-Objects
I'm changing the name of this ticket so it reflects the need for a tutorial here.
Cool, thanks, yes I noticed the horrible use of ids to link between resources, also the fact that they are linked to templates.
Hello,
How did you get it working? I cant get it working to create multiple resources => they overwrite each other so i only get one resource I have tried it with id set, emtpy id and without id and even the php and the json way?
Here's a tutorial: https://github.com/craftsmancoding/repoman/wiki/Tutorial--Resources
Hello,
Thank you for the tutorial :) I have a little improvement for the tutorial: Highlight the Part with build_attributes => "To correctly seed Resources you also have to add "build_attributes": { "modResource": { "preserve_keys": true, "update_object": true, "unique_key": "alias" } } in your composer.json file "
Good idea. Done.
Is it possible to use repoman to store and update the resources?
IF so how would that be done?