Use require_once instead of require and you should be fine.



davide schrieb:
Good morning.

I'm trying to extends a class (a custom base model) that extends the
AppModel.

I've already done it for the controllers. I have a CustomController that
extends the AppController and then I have all my controllers that
extends the CustomControllers (code at the end).

Now, as I said before, I'm trying to do the same with the model, but I
always get the error

Fatal error: Cannot redeclare class mycustommodel in
H:\www\multi-cake\casting\models\Mycustommodel.php on line 2

for every class names I specify.

Code at the end.

What it could be?

Thanks a lot
Davide

//////////////
//controllers/custom_controller.php
class CustomController extends AppController{
   //some variables/method useful for all controllers
}

/////////////
//controllers/users_controller.php
require("custom_controller.php");

class UsersController extends CustomController{
   var $name="Users";
   var $scaffold;

   //my actions
}

/////////////
//models/mycustommodel.php
class Mycustommodel extends AppModel{
   //...
}

/////////////
//models/user.php
require("mycustommodel.php");
class User extends Mycustommodel{
   //...
}

  

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to