magic __get methods for findByColumn() calls, but it triggers on
anything.
@OP - Your model isn't being loaded, the AppModel is. Your conventions
are off.
On Jun 5, 4:17 pm, Ryan Schmidt <google-2...@ryandesign.com> wrote:
> On Jun 5, 2011, at 04:45, cake-learner wrote:
>
>
>
>
>
>
>
>
>
> > I just add an function to model and call that function from another
> > controller.
> > but what i get is the following error. What happen?????
>
> > In Model( department.php ),
>
> > class Department extends AppModel {
> > var $useDbConfig = 'default_account';
> > function get_child_dep( $dep_id, $child ){
> > }
> > }
>
> > In Controll( orgmap_controller.php ),
>
> > $this -> loadModel( 'Department' );
> > $this -> Department -> get_child_dep( 1 )
>
> > error message ----
> > Warning (512): 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 'get_child_dep' at line 1 [CORE/cake/libs/
> > model/datasources/dbo_source.php, line 535]
>
> CakePHP turns unknown methods into SQL statements. I don't know why that's a useful feature, but apparently it is. So it means that your model file is not actually being used (and CakePHP is generating its own default model, which doesn't have that function you made). Looking at your code I'm not sure however why this is happening. Are you sure the model file is in the models directory and has the right name (department.php)?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment