Cake 1.2.0.6311-beta
Attachments 0.40RC

I'm trying to get David Persson's Attachments behavior/component
working with little success. I can't get it to pick up any attachments
for my model. I've been poring over the source and am still a little
baffled as to how this should work. Because of that, I'm having a lot
of dificulty figuring out where the problem lies (Well, I think the
problem lies with my limited understanding of the way Cake works,
generally).

This part of my app looks like this:

Member->hasMany->Showcase

A Showcase is essentially an item in a Member's gallery.

I have a table named 'attachments' and have inserted the image (and
video, audio) data into it, eg:

id          | 415
model       | Showcase
foreign_key | 234
dirname     | files/showcase/espana_keller_j
basename    | espana_keller_39692.mov
checksum    | 86fb86893fd829912145f303f39e869b
mime_type   | video/quicktime
thumbnail   | espana_keller_39692.png
created     | 2008-02-13 20:12:57.99675
modified    | 2008-02-13 20:12:57.99675


AppModel has:

var $actsAs = array('Bindable' => array('notices' => true));
(perhaps this is causing problems?)

Showcase model has:
var $actsAs = array('Attachment' => array(
                                        'dirname' => '{DIRNAME}',
                                        'basename' => '{BASENAME}'
                                        )
);

I don't know if that syntax is correct for overriding the defaults.

The ShowcasesController has:

var $components = array('Attachment');

function index()
{
        $conditions = array(
                'restrict' => array(
                        'Member(first_name, last_name, slug)'
                )
        );

        $showcases = $this->Showcase->find('all', $conditions);
        ...
}

Now, maybe using Bindable is the problem here, but I can't find
anything in the docs for  Attachment that says I must specify any
conditions at all. However, I do see this warning (thrown because
there are no conditions):

Warning (2): Invalid argument supplied for foreach() [APP/models/
behaviors/attachment.php, line 233]

When I try adding conditions appropriate to Attachment I see this:

Notice (1024): Showcase.Attachment is not a valid binding [APP/models/
behaviors/bindable.php, line 465]

Anyone have any ideas of what I should have in my controller to get it
to pick up the Attachments specific to each Showcase when I do a
find('all')?


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

Reply via email to