You can setup a database table that is basically an index into your file system.

This might be helpful if you want to store metadata about the files as well.  Gallery does this for images too.

So your table would have and id, name, description, location, etc, and a path field.

The path field is where the file/picture is on the filesystem.

Then cake can make associations using the standard id/inflection system.

When deleting a picture in the model it will delete the database entry, you just add a piece of code to your model that also unlinks the file.

Scalability wise this will also be a more robust solution.

On 8/16/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:

Models without tables should still be able to be associated.

If I have a

Product hasMany ProductImage hasOne FileHandler

ProductImage stores information about the file in the database.
Filehandler handles uploading, deleting the file physically from the
disk.

I could setup a really cool way to delete all product files when the
Product is deleted.  But , I need FileHandler to be associated to
ProductImage.

Then I override function the delete function in ProductImage

del($id, $cascade = true){
   parent::del($id,$cascade);
   $this->FileHander->delete($whatever);
}

Perfect!!!

However, Cake tries to do database stuff on FileHandler and it throws a
bunch of errors.

Cake should know that $useTable = false; means that, even with
associations.

Yah, I know, file a ticket, I will.  Anyone tried to do anything like
this successfully?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to