Changeset 4543
- Timestamp:
- 06/22/08 03:33:50 (13 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/manual/docs/en/getting-started/auto-loading-models.txt
r4159 r4543 1 1 Doctrine offers two ways of loading models. We have conservative(lazy) loading, and aggressive loading. Conservative loading 2 2 will not require the PHP file initially, instead it will cache the path to the class name and this path is then used in the 3 Doctrine::autoload() we registered earlier with spl_autoload_register(array('Doctrine', 'autoload')). Below are some examples3 Doctrine::autoload() we registered earlier with spl_autoload_register(array('Doctrine', 'autoload')).de Below are some examples 4 4 using the both types of model loading. 5 5 … … 9 9 load all of the models instead of loading them all when model loading is executed. 10 10 11 Conservative model loading requires that each file contain only one class, and the file must be named after the class. Example, 12 if you have a class named User, it must be contained in a file named User.php 11 Conservative model loading requires that each file contain only one class, and the file must be named after the class. For example, if you have a class named User, it must be contained in a file named User.php 13 12 14 13 Here is an example of a basic Doctrine implementation using conservative model loading. … … 32 31 include them in the correct order so it is up to you to make sure all dependencies are satisfied in each class. 33 32 34 With aggressive model loading you can have multiple classes per file, one class per file, and the file name is not 35 required to be related to the name of the class inside of the file. 33 With aggressive model loading you can have multiple classes per file and the file name is not required to be related to the name of the class inside of the file. 36 34 37 35 The downside of aggressive model loading is that every php file is included in every request, so if you have lots of models