As a heads up make sure you avoid reserved words in php as well as cake

On 8/12/07, Muhammad Ishaq <[EMAIL PROTECTED]> wrote:
> Thanks a lot Geoff, It solved the problem... :) Everything works fine now...
>
> CakePHP is really MVC taken to the extreme...
>
>
> On 8/13/07, Geoff Ford <[EMAIL PROTECTED]> wrote:
> >
> > Looking at the screenshot - it appears that you are using a Model
> > called File.  There is a core class called File so try changing the
> > name of your model.
> >
> > Geoff
> > --
> > http://lemoncake.wordpress.com
> >
> > On Aug 13, 3:51 am, "Muhammad Ishaq" < [EMAIL PROTECTED]> wrote:
> > > Sorry, the lines that had displayed notices from cake in the above
> message
> > > have become a mess, I tried to copy them through Kate, but it still
> copies a
> > > lot of data...
> > >
> > > On 8/12/07, Muhammad Ishaq <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > > Hi,
> > >
> > > >          I just installed cake ( 1.2.x.x) yesterday and have been
> reading
> > > > the online resources, however, when I have tried to do little
> > > > experimentation, it didn't like me very much.
> > >
> > > >          Following is my setup:
> > >
> > > >    - CakePHP  1.2.x.x (inside /var/www/cake, the Document root is set
> > > >    to /var/www, so I access cake with
> > > >    http://localhost/cake/controller/action )
> > > >    - PHP5
> > > >    - Apache2.2
> > > >    - MySql5
> > > >    - running on Ubuntu Fiesty (7.04)
> > >
> > > > My Model Class Looks like:
> > >
> > > > // user.php
> > > > <?php
> > > > class User extends AppModel {
> > >
> > > >     var $name = 'User';
> > > >     var $validate = array(
> > > >         'id' => VALID_EMAIL,
> > > >         'modified_by' => VALID_EMAIL,
> > > >     );
> > > > ?>
> > >
> > > > and the controller looks like:
> > >
> > > > // users_controller.php
> > > > <?php
> > > > class UsersController extends AppController {
> > >
> > > >     var $name = 'Users';
> > > >     var $scaffold;
> > > > }
> > > > ?>
> > >
> > > > when I accesshttp://localhost/cake/users/, it gives
> me the screen
> > > > attached with this message (it has a number of notices but i guess
> that's
> > > > normal with DEBUG,2. However, at the bottom of the records table, it
> has
> > > > links for "New User, New S and New" (what are 'New S' and 'New' for?)
> > >
> > > > Here's the problem:
> > > > 1. When I click "New User", it opens a page to add new user, but if I
> > > > click "New S" or "New", an error is generated (and I think New S or
> New
> > > > should not be there in first place when "New User" is already there).
> > > > 2. When I click "Edit" or "View" link for a record, it gives me the
> > > > following errors:
> > >
> > > > *Notice* (8): Undefined property:  File::$table
> [*CORE/cake/libs/model/model.php*, line *640*]
> > >
> > > >  Context | Code
> > >
> > > > $assoc     =       "File"
> > > > $className =       "File"
> > > > $id        =       false
> > > > $table     =       null
> > > > $ds        =       null
> > > > $colKey    =       "file"
> > >
> > > >             }
> > >
> > > >         }
> > >
> > > >         $this->alias[$assoc] = $this->{$assoc}->table;
> > >
> > > >         $this->tableToModel[$this->{$assoc}->table] =
> $className;
> > >
> > > > Model::__constructLinkedModel() - CORE/cake/libs/model/model.php, line
> 640
> > > > Model::__createLinks() - CORE/cake/libs/model/model.php, line 593
> > > > Model::__construct() - CORE/cake/libs/model/model.php, line 351
> > > > Controller::constructClasses() -
> CORE/cake/libs/controller/controller.php, line 373
> > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 305
> > > > [main] - CORE/app/webroot/index.php, line 83
> > >
> > > > *Notice* (8): Undefined property:  File::$table
> [*CORE/cake/libs/model/model.php*, line *641*]
> > >
> > > >  Context | Code
> > >
> > > > $assoc     =       "File"
> > > > $className =       "File"
> > > > $id        =       false
> > > > $table     =       null
> > > > $ds        =       null
> > > > $colKey    =       "file"
> > >
> > > >         }
> > >
> > > >         $this->alias[$assoc] = $this->{$assoc}->table;
> > >
> > > >         $this->tableToModel[$this->{$assoc}->table] =
> $className;
> > >
> > > >         $this->modelToTable[$assoc] = $this->{$assoc}->table;
> > >
> > > > Model::__constructLinkedModel() - CORE/cake/libs/model/model.php, line
> 641
> > > > Model::__createLinks() - CORE/cake/libs/model/model.php, line 593
> > > > Model::__construct() - CORE/cake/libs/model/model.php, line 351
> > > > Controller::constructClasses() -
> CORE/cake/libs/controller/controller.php, line 373
> > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 305
> > > > [main] - CORE/app/webroot/index.php, line 83
> > >
> > > > *Notice* (8): Undefined property:  File::$table
> [*CORE/cake/libs/model/model.php*, line *642*]
> > >
> > > >  Context | Code
> > >
> > > > $assoc     =       "File"
> > > > $className =       "File"
> > > > $id        =       false
> > > > $table     =       null
> > > > $ds        =       null
> > > > $colKey    =       "file"
> > >
> > > >         $this->alias[$assoc] = $this->{$assoc}->table;
> > >
> > > >         $this->tableToModel[$this->{$assoc}->table] =
> $className;
> > >
> > > >         $this->modelToTable[$assoc] = $this->{$assoc}->table;
> > >
> > > >     }
> > >
> > > > Model::__constructLinkedModel() - CORE/cake/libs/model/model.php, line
> 642
> > > > Model::__createLinks() - CORE/cake/libs/model/model.php, line 593
> > > > Model::__construct() - CORE/cake/libs/model/model.php, line 351
> > > > Controller::constructClasses() -
> CORE/cake/libs/controller/controller.php, line 373
> > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 305
> > > > [main] - CORE/app/webroot/index.php, line 83
> > >
> > > > *Notice* (8): Undefined property:  File::$table
> [*CORE/cake/libs/model/model.php*, line *685*]
> > >
> > > >  Context | Code
> > >
> > > > $type      =       "belongsTo"
> > > > $assocData =       array("className" => "File", "foreignKey" =>
> "file_id", "conditions" => "", "fields" => "", "order" => "", "counterCache"
> => "")
> > > > $assocKey  =       "File"
> > > > $class     =       "File"
> > > > $key       =       "foreignKey"
> > > > $data      =       ""
> > >
> > > >                 }
> > >
> > > >                 if ($key == 'foreignKey' &&
> !isset($this->keyToTable[$this->{$type}[$assocKey][$key]]))
> {
> > >
> > > >
> $this->keyToTable[$this->{$type}[$assocKey][$key]][0] =
> $this->{$class}->table;
> > >
> > > >
> $this->keyToTable[$this->{$type}[$assocKey][$key]][1] =
> $this->{$class}->name;
> > >
> > > > Model::__generateAssociation() - CORE/cake/libs/model/model.php, line
> 685
> > > > Model::__createLinks() - CORE/cake/libs/model/model.php, line 599
> > > > Model::__construct() - CORE/cake/libs/model/model.php, line 351
> > > > Model::__constructLinkedModel() - CORE/cake/libs/model/model.php, line
> 635
> > > > Model::__createLinks() - CORE/cake/libs/model/model.php, line 593
> > > > Model::__construct() - CORE/cake/libs/model/model.php, line 351
> > > > Controller::constructClasses() -
> CORE/cake/libs/controller/controller.php, line 373
> > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 305
> > > > [main] - CORE/app/webroot/index.php, line 83
> > >
> > > > *Notice* (8): Undefined property:  File::$useDbConfig
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line
> *582*]
> > >
> > > >  Context | Code
> > >
> > > > $this      =       DboMysql object
> > > > $model     =       User object
> > > > $queryData =       array("conditions" => array, "fields" => array,
> "joins" => array, "limit" => 1, "offset" => array, "order" => array)
> > > > $recursive =       null
> > > > $null      =       null
> > > > $array     =       array()
> > > > $linkedModels      =       array()
> > > > $type      =       "hasMany"
> > > > $assocData =       array("className" => "File", "foreignKey" =>
> "user_id", "conditions" => "", "fields" => "", "order" => "", "limit" => "",
> "offset" => "", "dependent" => "", "exclusive" => "", "finderQuery" => "",
> "counterQuery" => "")
> > > > $assoc     =       "File"
> > > > $linkModel =       File object
> > > > $external  =       false
> > >
> > > >                             $linkedModels[] = $type . '/' . $assoc;
> > >
> > > >                         }
> > >
> > > >                     } else {
> > >
> > > >                         if ($model->useDbConfig ==
> $linkModel->useDbConfig) {
> > >
> > > >                             if (true ===
> $this->generateAssociationQuery($model, $linkModel, $type,
> $assoc, $assocData, $queryData, $external, $null)) {
> > >
> > > > DboSource::read() -
> CORE/cake/libs/model/datasources/dbo_source.php, line 582
> > > > Model::findAll() - CORE/cake/libs/model/model.php, line 1379
> > > > Model::find() - CORE/cake/libs/model/model.php, line 1306
> > > > Model::read() - CORE/cake/libs/model/model.php, line 893
> > > > Scaffold::__scaffoldView() -
> CORE/cake/libs/controller/scaffold.php, line 220
> > > > Scaffold::__scaffold() -
> CORE/cake/libs/controller/scaffold.php, line 422
> > > > Scaffold::__construct() -
> CORE/cake/libs/controller/scaffold.php, line 198
> > > > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 351
> > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 333
> > > > [main] - CORE/app/webroot/index.php, line 83
> > >
> > > > *Notice* (8): Undefined property:  File::$useDbConfig
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line
> *609*]
> > >
> > > >  Context | Code
> > >
> > > > $this      =       DboMysql object
> > > > $model     =       User object
> > > > $queryData =       array("conditions" => array, "fields" => array,
> "joins" => array, "limit" => 1, "offset" => array, "order" => array)
> > > > $recursive =       null
> > > > $null      =       null
> > > > $array     =       array()
> > > > $linkedModels      =       array()
> > > > $type      =       "hasMany"
> > > > $assocData =       array("className" => "File", "foreignKey" =>
> "user_id", "conditions" => "", "fields" => "", "order" => "", "limit" => "",
> "offset" => "", "dependent" => "", "exclusive" => "", "finderQuery" => "",
> "counterQuery" => "")
> > > > $assoc     =       "File"
> > > > $linkModel =       File object
> > > > $external  =       false
> > > > $query     =       "SELECT `User`.`id`, `User`.`privilage_level`,
> `User`.`full_name`, `User`.`nick`, `User`.`gender`, `User`.`date_of_birth`,
> `User`.`country`, `User`.`created`, `User`.`modified`, `User`.`modified_by`
> FROM `gs_users` AS `User`   WHERE `User`.`id`  =  '
> > > > [EMAIL PROTECTED]'   LIMIT 1"
> > > > $resultSet =       array(0 => array)
> > > > $filtered  =       array()
> > > > $db        =       null
> > >
> > > >                     $linkModel =& $model->{$assoc};
> > >
> > > >                     if (!in_array($type . '/' . $assoc,
> $linkedModels)) {
> > >
> > > >                         if ($model->useDbConfig ==
> $linkModel->useDbConfig) {
> > >
> > > >                             $db =& $this;
> > >
> > > > DboSource::read() -
> CORE/cake/libs/model/datasources/dbo_source.php, line 609
> > > > Model::findAll() - CORE/cake/libs/model/model.php, line 1379
> > > > Model::find() - CORE/cake/libs/model/model.php, line 1306
> > > > Model::read() - CORE/cake/libs/model/model.php, line 893
> > > > Scaffold::__scaffoldView() -
> CORE/cake/libs/controller/scaffold.php, line 220
> > > > Scaffold::__scaffold() -
> CORE/cake/libs/controller/scaffold.php, line 422
> > > > Scaffold::__construct() -
> CORE/cake/libs/controller/scaffold.php, line 198
> > > > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 351
> > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 333
> > > > [main] - CORE/app/webroot/index.php, line 83
> > >
> > > > *Notice* (8): Undefined property:  File::$useDbConfig
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line
> *612*]
> > >
> > > >  Context | Code
> > >
> > > > $this      =       DboMysql object
> > > > $model     =       User object
> > > > $queryData =       array("conditions" => array, "fields" => array,
> "joins" => array, "limit" => 1, "offset" => array, "order" => array)
> > > > $recursive =       null
> > > > $null      =       null
> > > > $array     =       array()
> > > > $linkedModels      =       array()
> > > > $type      =       "hasMany"
> > > > $assocData =       array("className" => "File", "foreignKey" =>
> "user_id", "conditions" => "", "fields" => "", "order" => "", "limit" => "",
> "offset" => "", "dependent" => "",
> > >
> > > ...
> > >
> > > read more >>
> >
> >
> >
>
>
> Regards,
> MI
>
> - Programming can be fun, so can be cryptography, however they should not be
> combined ...
>  >
>


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

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