I can't believe I was so blind! Thanks a lot! This is definitely the cause.

Vadim.

On 24 March 2010 14:12, Lucca Mordente <luccamorde...@gmail.com> wrote:

> Aren't you working with the wrong model?
> The model you created is being called Photos and you are using Photo
> on tour controller.
>
> Lucca Mordente
>
>
> On 24 mar, 07:13, Vadim Frolov <fra...@gmail.com> wrote:
> > Hi all!
> >
> > I created a simple model:
> > class Photos extends AppModel {
> >      var $name = 'Photos';
> >      var $actsAs = array('Aircraft');
> >
> > }
> >
> > Put file 'aircraft.php' in app/models/behaviors'. It has only one method:
> > class AircraftBehavior extends ModelBehavior
> > {
> >     function setup(&$model, $settings = array())
> >     {
> >     }
> >
> >     function flyto(&$model, $from, $to)
> >     {
> >          echo "Flying from {$from} to {$to} \n<br />";
> >     }
> >
> > }
> >
> > Then in my PhotosController I do call "$this->Photo->flyto("toronto",
> > "monreal");" and get the error "SQL Error: 1064: You have an error in
> your
> > SQL syntax; check the manual that corresponds to your MySQL server
> version
> > for the right syntax to use near 'flyto' at line 1". It seems that the
> > method "flyto" is treated as SQL command.
> >
> > If I add $this->Photo->Behaviors->attach('Aircraft');" before actual call
> of
> > "flyto" method, then everything is all right. Why can this happens, that
> > "actAs" does nothing?
> >
> > Best regards,
> > Vadim.
>
> 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe from this group, send email to cake-php+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to