This is "model1" (in a is a plug-in,called "sis") sis_field.php
<?php
class SisField extends SisAppModel {

        var $name = 'SisField';
        var $belongsTo = array(
                'SisContact' => array(
                        'className' => 'SisContact',
                        'foreignKey' => 'sis_contact_id'
                )
        );

        var $hasMany = array(
                'SisQueue' => array(
                        'className' => 'SisQueue',
                        'foreignKey' => 'sis_field_id'
                )
        );

}
?>

This is model 2, "put" does not do much yet because I was stopped from
the error
(sis_queue.php)
<?php
class SisQueue extends SisAppModel {

        var $name = 'SisQueue';
        var $belongsTo = array(
                'SisField' => array(
                        'className' => 'SisField',
                        'foreignKey' => 'sis_field_id',
                        'conditions' => '',
                        'fields' => '',
                        'order' => ''
                )
        );

        function put($ids){
            $q=$this->find('all');
            return $q;
        }

}
?>

I call then the function from the SisField controller:
(sis_fields_controller.php)

$this->SisField->SisQueue->put($ids);

as you see it's all very simple...don't understand what I'm doing
wrong...for sure something that will make a fool out of me...

i I call the find statement from the controller everything is fine, so
the connection between the models are set-up correctly I think!


On 4 Mar, 18:58, Andy Dirnberger <[email protected]> wrote:
> What is the actual name of model2 and what is its filename? If the
> file isn't being found, model2 is of type AppModel and not model2,
> which would explain why you can't access a method defined in model2.
>
> On Mar 4, 12:36 pm, mathaios <[email protected]> wrote:
>
> > Hallo all bakers! I hope someone can help me...
>
> > I have two models related trough a "to many-belongs to" relationships.
> > I've set in model2 a method called "put" that do some db manipulation.
>
> > But when I call the "put" method from the related model1 controller
> > (as $this->model1->model2->put() ) the method name get's executed like
> > an SQL query!
> > But if I call something like e.g. $this->model1->model2->find('all')
> > records are correctly fetched.
>
> > What can be the problem? I'm getting mad on this !
> > Thanks for any advice

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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