Database relations and advanced packages

Permalink
Hi,

I want to start building blocks/packages for concrete5.
I think I'm familiar with the very basics.

Now I want to be able to add database relations, I could't find a sample for ADODB XML.

Does anyone know any good tutorials for advanced block/packages creation?

Or are there any sample blocks in the core which could help me?


------------------------------------

In future I want to create a soccer prediction addon, so there has to be user specific data which can be saved in the frontend.

Are there any samples to do anything like this?


Thanks
Greetz eztam

 
mouloud replied on at Permalink Reply
I have the same question : is there any way in concrete5 to manage table relation in customs blocks ? Like a simple employees->company relation ?
Thanks
jordanlev replied on at Permalink Reply
jordanlev
You basically need to manage relationships yourself. Concrete5 does include the ADODB library for database access, which has a basic ActiveRecord implementation, but it is woefully incomplete (kind of buggy, doesn't have many-to-many relationships, etc.). You can check out the free "Email List Signup" addon which I created a while back and used the ActiveRecord stuff for it. But now I just find that most blocks are so simple it's not too bad to just use SQL statements to manage relationships. Check out the built-in "Slideshow" block for an example of how to deal with related records (basically declare a second table in the block's db.xml file, then you need to manually create/update/delete those secondary records in the controller's save(), duplicate(), and delete() methods).
Silasj replied on at Permalink Reply
Silasj
I don't know if you're still looking for an answer, but what I've done is include php ActiveRecord in the package's libraries, load it in the controller, and then manage relations in the models. You do have to set up the foreign keys in your db.xml file, though.