application database design
Permalink
Hi, I'm developing an application for C5 that will have pages in the dashboard for administration and customizable blocks available to insert on pages. I'd like to use C5's db access via bt tables naming scheme, but my blocks will access data across multiple tables. Is this doable? Or do I need to write custom queries to access the data for each block?
Forgive me please if this is already answered in the docs or forum, I've searched but not come across anything.
TIA
gene
Forgive me please if this is already answered in the docs or forum, I've searched but not come across anything.
TIA
gene
The Survey and SlideShow blocks use multiple tables. You can have a look at the code /concrete/blocks/slide_show and /survey
okhayat is exactly right, but if you are creating an application and not a block, then it is best to use your package's db.xml(just like a block) that sits in the root of your package and that gets refreshed just like a block does(or installed).
Thank you okhayat and scottc for the replies. After following that and having a better look, I understand how I've misworded my misunderstanding. =0)
I thought I understood that by defining a db.xml that the framework would expose those fields automatically. I see now that data access actually happens from work done in the controllers (usually), and is not a part of the framework. In thinking that, I was actually wondering how I define relationships with different tables in the db.xml so that joins and relative data gets accessed and updated correctly. It is now my understanding, after looking at the slideshow controller.php, that the "magic" is actually manually coded somewhere, as opposed to framework apis that make it happen.
If i've once again misunderstood, please correct me, and thanks again for listening and offering advice.
I thought I understood that by defining a db.xml that the framework would expose those fields automatically. I see now that data access actually happens from work done in the controllers (usually), and is not a part of the framework. In thinking that, I was actually wondering how I define relationships with different tables in the db.xml so that joins and relative data gets accessed and updated correctly. It is now my understanding, after looking at the slideshow controller.php, that the "magic" is actually manually coded somewhere, as opposed to framework apis that make it happen.
If i've once again misunderstood, please correct me, and thanks again for listening and offering advice.
yeah i just use mysql but there is some ORM wrappers with adodb which is a on my to-do list of things to look into. Anything it appears that extends model has these exposed if the table is created correctly, but I haven't sat down to try to leverage that.
So basically in my case at least it is all just typed mysql :(
magic happens in the mappings of the blockController properties to btTable fields, haven't really looked at how that even works to be honest, but I have a pretty good idea :)
So basically in my case at least it is all just typed mysql :(
magic happens in the mappings of the blockController properties to btTable fields, haven't really looked at how that even works to be honest, but I have a pretty good idea :)
The framework is MVC (model-view-controller). The model interacts with the database. The controller interacts with the model. The view interacts with the controller. Customized database manipulation is coded in the model.