-
MODX Staff
- 10,725 Posts
Using both would be the best choice. That way, you can have normalized, searchable tables with summarized pre-processed values stored in the properties field for use when reading.
-
MODX Staff
- 10,725 Posts
That is the precise gist of it. Thanks for translating for those who are not so impressed by my brevity.
-
☆ A M B ☆
- 318 Posts
OK, but a problem has occurred to me. How do you update the properties field if the values in your tables change? I suppose you could attach something to the clear cache event...
Override the save() method in your custom table's xPDOObject class, and update the properties related modResource class after calling parent::save() in the related class.
shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect |
github |
splittingred.com
-
☆ A M B ☆
- 318 Posts
Awesome, thanks guys!
This is a really cool idea with lots of possibilities -- like for images, you could store the original image URL in a table (along with other image properties like EXIF data), use PHPthumb to render a thumbnail, then store the thumbnail URL in the properties field. That would be blazing fast on the front end. Then if you change the image, you re-render the thumb using the save() method for the images table, so you could even change the image from somewhere other than the resource itself (like by using some sort of batch updater or something) and still update the resource properties. Very cool...