Changeset 4742

Show
Ignore:
Timestamp:
08/07/08 14:27:07 (11 months ago)
Author:
jwage
Message:

fixes #1207

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/docs/manual/en/behaviors.txt

    r4681 r4742  
    1111classes can load. When a template is being loaded its setTableDefinition() and setUp() methods are being invoked and the  
    1212method calls inside them are being directed into the class in question. 
    13  
    1413 
    1514++ Core Behaviors 
     
    902901    content: string 
    903902</code> 
     903 
     904++ Generating Files 
     905 
     906By default with behaviors the classes which are generated are evaluated at  
     907run-time and no files containing the classes are ever written to disk. This can  
     908be changed with a configuration option. Below is an example of how to configure 
     909the I18n behavior to generate the classes and write them to files instead of  
     910evaluating them at run-time. 
     911 
     912<code type="php"> 
     913class NewsArticle extends Doctrine_Record 
     914{ 
     915    public function setTableDefinition() 
     916    { 
     917        $this->hasColumn('title', 'string', 255); 
     918        $this->hasColumn('body', 'string', 255); 
     919        $this->hasColumn('author', 'string', 255); 
     920    } 
     921 
     922    public function setUp() 
     923    { 
     924        $this->actAs('I18n', array('fields'          => array('title', 'body'), 
     925                                   'generateFiles'   => true, 
     926                                   'generatePath'    => '/path/to/generate')); 
     927    } 
     928} 
     929</code> 
     930 
     931Now the behavior will generate a file instead of generating the code and using  
     932eval() to evaluate it at runtime.