Changeset 19862
- Timestamp:
- 07/03/09 20:35:54 (9 months ago)
- Files:
-
- doc/branches/1.1/cookbook/en/behaviors.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/branches/1.1/cookbook/en/behaviors.txt
r13948 r19862 43 43 ------------ 44 44 45 Now, imagine that you need to keep also the deleted records of the `comment` table. Instead of copying the two methods above in the `Comment` and `CommentPeer` classes, which would not be [D.R.Y.](http://en.wikipedia.org/wiki/Don't_repeat_yourself), you should refactor the code used more than once in a new class, and inject it via the *Mixins* system. You should be familiar with the concept of Mixins and the `sfMixer` class to understand the following, so refer to [Chapter 17](http://www.symfony-project.org/book/1_ 1/17-Extending-Symfony#Mixins) of the symfonybook if you wonder what this is about.45 Now, imagine that you need to keep also the deleted records of the `comment` table. Instead of copying the two methods above in the `Comment` and `CommentPeer` classes, which would not be [D.R.Y.](http://en.wikipedia.org/wiki/Don't_repeat_yourself), you should refactor the code used more than once in a new class, and inject it via the *Mixins* system. You should be familiar with the concept of Mixins and the `sfMixer` class to understand the following, so refer to [Chapter 17](http://www.symfony-project.org/book/1_0/17-Extending-Symfony#Mixins) of the symfony 1.0 book if you wonder what this is about. 46 46 47 47 The first step is to remove any code from the model classes, and to add hooks to allow them to be extended. … … 288 288 There is a non-written convention about behavior plugin names. They must be prefixed with 'Propel' since they work only for this ORM, and they must end with 'BehaviorPlugin'. So a good name for our Paranoid behavior could be 'myPropelParanoidBehaviorPlugin'. 289 289 290 As of now, there are only two files to put in the plugin: the `ParanoidBehavior` class, and the code written in `config/config.php` to register the behavior methods and hooks. [Chapter 17](http://www.symfony-project.org/book/1_1/17-Extending-Symfony# Plug-Ins) explains how to organize these files in a plugin tree structure:290 As of now, there are only two files to put in the plugin: the `ParanoidBehavior` class, and the code written in `config/config.php` to register the behavior methods and hooks. [Chapter 17](http://www.symfony-project.org/book/1_1/17-Extending-Symfony#chapter_17_plug_ins) explains how to organize these files in a plugin tree structure: 291 291 292 292 plugins/

