Re: Dilemma over choosing right model table structure

2008-11-10 Thread teknoid
Are you using GUID's id's and foregin_keys? If not, you could set yourself for some serious trouble down the road. Also, take a look at the polymorphic behavior, I think it might be some help here. On Nov 8, 6:43 am, Marcus Silva [EMAIL PROTECTED] wrote: I think your solution is very good, but

Re: Dilemma over choosing right model table structure

2008-11-08 Thread Adam Royle
Well, not really, you just need one images table for that. Then in your models you just have an image_id, and set your associations up like this: class Shop extends AppModel { var $belongsTo = array( 'Image' = array('className' = 'Image', 'foreignKey' = 'image_id')

Re: Dilemma over choosing right model table structure

2008-11-08 Thread Marcus Silva
I think your solution is very good, but it does not suit my needs as the system I am building is rather complex. Instead I am going to use the following solution to store all my images: Images table: id foreign_id //user_id associated_model //User...-- Image-belongsTo = User/Shop/Album/

Dilemma over choosing right model table structure

2008-11-07 Thread Marcus Silva
Hi folks, I am trying to create system which will let users upload media to the server, the question that I ask is weather using a single table to store the uploaded files is better than using separate tables to store each file type in terms of coding. Seems to me that if I use the multiple

Re: Dilemma over choosing right model table structure

2008-11-07 Thread teknoid
if it's always going to be the same data, then you should go with a single table, and designate media_type column... on the other hand i see that you have a column hasThumb (or has_thumb)... that obviously cannot apply to audio. On Nov 7, 12:06 pm, Marcus Silva [EMAIL PROTECTED] wrote: Hi

Re: Dilemma over choosing right model table structure

2008-11-07 Thread Adam Royle
The way I do this: Tables: - images - videos - documents Each of the tables has the standard fields like mime_type, filesize, path, etc. And each custom type has any extra fields that may be necessary (width, height, duration, bitrate, etc). Behaviors: - FileBehavior - ImageBehavior extends

Re: Dilemma over choosing right model table structure

2008-11-07 Thread Marcus Silva
That does help Adam. Thats exactly the way I will do it now. But I think I will end up with many tables which is what really puts me off. But thats not a problem. Should have ShopImage, AlbumImage ProfileImage and so on... Many thanks to all for helping out. Cheers On Nov 7, 10:42 pm,

Re: Dilemma over choosing right model table structure

2008-11-07 Thread rgreenphotodesign
For images(photos specifically) do you store the exif data as well? On Nov 7, 4:29 pm, Marcus Silva [EMAIL PROTECTED] wrote: That does help Adam.  Thats exactly the way I will do it now. But I think I will end up with many tables which is what really puts me off.  But thats not a problem.

Re: Dilemma over choosing right model table structure

2008-11-07 Thread Dr. Tarique Sani
On Sat, Nov 8, 2008 at 6:01 AM, rgreenphotodesign [EMAIL PROTECTED] wrote: For images(photos specifically) do you store the exif data as well? If not using native PHP exif functions extracting exif every time is expensive - I prefer to extract, sanitize, serialize and store it in DB Tarique

Re: Dilemma over choosing right model table structure

2008-11-07 Thread Sergei
I think better to make one table for all content types. And make a content_type column or something. It will be faster and easier to work with such model. On 8 нояб, 01:06, Marcus Silva [EMAIL PROTECTED] wrote: Hi folks, I am trying to create system which will let users upload media to the