Hello,
in Step 9 ist the Answer for Brian's ask. CmsAppModel is generate with
'CakeBuilder'. This class is emty. Below is the complete definition
provided. The model's were created for a plugin (CMS). The Plugin is
also generate with 'CakeBuilder' (cake bake plugin cms model)
class CmsAppModel extends AppModel {
}
class CmsFolder extends CmsAppModel {
var $name = 'CmsFolder';
var $actsAs = array('Tree');
var $displayField = 'folder';
var $hasMany = array('CmsContent','CmsFile');
function getLocalTest() {
return 'www';
}
.........
Best Regards
Uwe
On 15 Okt., 18:38, John Andersen <[email protected]> wrote:
> As Brian asked, does your CmsFolder model inherit from AppModel or
> something else?
> Please show the code, not write it from "faulty" memory! :)
>
> Also show the other model, if CmsFolder does not inherits from
> AppModel!
> Enjoy,
> John
>
> On Oct 15, 7:31 pm, Obelix <[email protected]> wrote:
>
> > someone has another idea ?
>
> > On 14 Okt., 18:57, Obelix <[email protected]> wrote:
>
> > > It's a model in a plugin. The name from the plugin is CMS. The class
> > > is defined as follows
>
> > > class CmsFolder extends CmsAppModel {
>
> > > On 14 Okt., 18:30, brian <[email protected]> wrote:
>
> > > > How does the model class look? It should be:
>
> > > > class CmsFolder extends AppModel {
>
> > > > Is that correct?
>
> > > > On Wed, Oct 14, 2009 at 4:55 AM, Obelix <[email protected]> wrote:
>
> > > > > Yes i have seen it. But i dont't know what is the Problem with the
> > > > > name Standard.
>
> > > > > I have generate the model and the Controller with 'Cake builder'. Cake
> > > > > has recognized the table and also the models and controllers. At the
> > > > > next Step i have test the naming Standard with
>
> > > > > - debug(Inflector::classify('cms_folders'));
>
> > > > > Cake tell me it's all correct (CmsFolder). How can i test the name
> > > > > definition before i create model and controller.
>
> > > > > On 14 Okt., 10:15, "Dr. Loboto" <[email protected]> wrote:
> > > > >> "AppModel Object" - cake did not find your model file and created
> > > > >> AppModel as Miles and Brian both already said.
>
> > > > >> On Oct 14, 2:57 am, Obelix <[email protected]> wrote:
>
> > > > >> > 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
-~----------~----~----~----~------~----~------~--~---