1. As long as you've run the build on your xml schema (similarly to how you do it in normal Extras so it generates the xPDO classes and maps, that's all the files you'll need. Make sure your CRC extends the modResource class.
2. You'll only need to run the addExtensionPackage call *once* - it's basically just adding your record to the setting. Make sure it's passing the proper path though.
3. No, your files can be anywhere (Articles is in core/components/articles/model/articles/article.class.php), as long as you're loading it correctly.
Can you post more of your directory structure, Extension Packages setting/path, and even your CRC class file?
shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect |
github |
splittingred.com
I dug into it a little deeper and found out why modX can't load resources from the database any more. Apparently, the fields declared by my CRC aren't added to the modx_site_content table's definition. Off course I can fix it by adding these fields manually, but that's less than ideal at best.
I guess that somewhere, I skipped a little step, but I'm not sure where. And since there is no field added to modResource in the tutorial's example, I'm a bit in the dark here.
Generally you should not be adding fields to CRC's, but only repurposing existing fields. If you want to add fields, you can add a related object (another table that references the site_content row) and override the loadInstance method for modResource to join that table on load of the Resource.
This is the preferred way to add new fields; Articles currently adds a new field or two, but wont as of the next revision for Revo 2.2.1.
shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect |
github |
splittingred.com