Hello,
i have test if Model available and it's look like good. The
Programcode
- debug($this->CmsFile->CmsFolder);
gives me Information about the Model 'CmsFolder'.
AppModel Object
(
[useDbConfig] => default
[useTable] => cms_folders
[displayField] => id
[id] =>
[data] => Array
(
)
[table] => cms_folders
[primaryKey] => id
[_schema] => Array
(
..........
What it could be even more ?
Regards Uwe
On 13 Okt., 18:56, brian <[email protected]> wrote:
> If Cake doesn't find the model, it uses AppModel. The latter does not
> have a method getLocalTest().
>
> On Tue, Oct 13, 2009 at 5:34 AM, Obelix <[email protected]> wrote:
>
> > Thanks for your Answer.
>
> > I will test it in the evening.
>
> > So that does not happen i generate the plugin(cms), model and
> > controller with 'Cake Code Generation'.
>
> > I am also surprised that the following code works
>
> > - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> > and the other code dont works.
>
> > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> > In both lines, we referenced the Model (CmsFolder)
>
> > Regards Uwe
>
> > On 13 Okt., 01:34, Miles J <[email protected]> wrote:
> >> That means that your model is not getting loaded, hence the custom
> >> method does not exist.
>
> >> Try printing out the parent object to see if the association is
> >> loaded, if it is not your naming conventions are wrong.
>
> >> On Oct 12, 3:47 pm, Obelix <[email protected]> wrote:
>
> >> > Hi,
> >> > if i run a local function in a other model, cake display a 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 'getLocalTest' at line 1 [CORE/cake/libs/
> >> > model/datasources/dbo_source.php, line 525]
>
> >> > The environment looks like this:
>
> >> > Definition Table:
> >> > - cms_folders
> >> > - cms_files
>
> >> > Definition Model:
> >> > - CmsFolder -> hasMany (CmsFile) the Filename is
> >> > 'cms_folder.php'
> >> > - CmsFile -> belongsTo (CmsFolder) the Filename is
> >> > 'cms_file.php'
>
> >> > Definition Controller:
> >> > - CmsFolders the
> >> > Filename is 'cms_folders_controller.php'
> >> > - CmsFiles the
> >> > Filename is 'cms_files_controller.php'
>
> >> > In the Model 'CmsFolder' i define a dummy function:
>
> >> > function getLocalTest() {
> >> > return 'www';
> >> > }
>
> >> > I want run the function 'getLocalTest()' in the action 'add' in the
> >> > controller 'CmsFilesController'. The Code looks like this.
>
> >> > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> >> > If this line is running, the error message is displayed. But when i
> >> > run the following function, its all ok.
>
> >> > - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> >> > I do not know what the problem is and hope for their help.
>
> >> > Regards Uwe
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---