Proper Use of the DB
PermalinkShould I create a new table to manage my links or use attributes or a combination of both?
My conclusion thus far is that the links do not belong in a block type table as those seem to map one record to a block instance and just hold parameters for that block (rather than a list of records to be displayed within the block, which is my end goal).
If so, the question I have there is what class should I extend for the individual prlink? Looks like most everything in the model layer extends Object but some things extend Model.
All of the add-ons I write(for now) extend object, It doesn't hurt to extend model but at that point you might want to just extend ADODB activerecord(not sure on the exact name) to get code completion on the methods available.
Extending object gives you a setPropertiesFromArray method which is useful for a $db->getRow() call or something along those lines.
Just checking to see if you or anyone else had some input on my follow-up question.
"* Concrete Model Class
* The model class extends the ADOdb active record class, allowing items that inherit from it to use the automatic create, updating, read and delete functionality it provides.
".
I came across this thread today because I'm trying to figure out which one to use. I'm leaning toward Model, but it'd be nice if there was one consistent one -- maybe if the core Object extended active record...
You can define the table either in your package's db.xml file, or the block's.
Then create a /model file with a class that extends the DatabaseItemList class and use that to select/filter your links - you'd get pagination, sorting etc. with very little work using that.
I wouldn't use attributes unless you were going to create pages for each entry.