0

I am new to doctrine(using version 1.2) and following the steps given in the documentation manual. I've installed and configured it perfectly. But i have a problem while working with models. I have followed each and every step and have successfully generated the models in the models folder.. but after that when i m using the demo code

  $user = new User();
  $user->username = 'jwage';
  $user->password = 'changeme';

it says..

  Fatal error:  Class 'User' not found in C:\wamp\www\test_doctrine\test.php on line 25

whilst if i check the output of

  Doctrine_Core::loadModels('models');

i get

 Array
(
[BaseUser] => BaseUser
[User] => User
[UserTable] => UserTable
)

how do i get access to the User class??

Sriniwas
  • 505
  • 2
  • 6
  • 21

1 Answers1

1

Doctrine is not loading the base classes. I had faced a similar problem and I solved it by modifying the autoload function wherein I am getting the base class and I require them then and there itself.

You then in the bootstrap.php file, after spl_autoload_register(array('Doctrine', 'autoload'));, you need to Doctrine_Core::loadModels('models');.

This way the base class gets included through the autoload function and the child class (in this case the User Class) can extend it and then you can access it.

Sid
  • 854
  • 9
  • 23