浏览代码

Merge pull request #166 from ayman-alkom/patch-1

improve doc
Mark Sch 9 年之前
父节点
当前提交
969d8aa597
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. 14 14
      docs/Behavior/Jsonable.md

+ 14 - 14
docs/Behavior/Jsonable.md

@@ -4,7 +4,19 @@ A CakePHP behavior to automatically store nested data as JSON string and return
 - Data can be of type array, params or list - or kept in JSON format
 - Data can be of type array, params or list - or kept in JSON format
 - Additional sanitize functionality with "clean", "sort" and "unique
 - Additional sanitize functionality with "clean", "sort" and "unique
 
 
-## Configs
+## Usage
+Attach it to your model's `Table` class in its `initialize()` like so:
+```php
+	$this->addBehavior('Tools.Jsonable', $options);
+```
+
+Tip: If you have other behaviors that might modify the array data prior to saving, better use a higher priority:
+```php
+$this->addBehavior('Tools.Jsonable', array('priority' => 11, ...));
+```
+So that it is run last.
+
+## Options
 | Key  | Default | Description |
 | Key  | Default | Description |
 | ------------- | ------------- | ------------- |
 | ------------- | ------------- | ------------- |
 | fields  | array() | Array of the fields to be converted  |
 | fields  | array() | Array of the fields to be converted  |
@@ -22,18 +34,6 @@ A CakePHP behavior to automatically store nested data as JSON string and return
 | decodeParams  |   | params for json_decode |
 | decodeParams  |   | params for json_decode |
 
 
 
 
-## Usage
-Attach it to your models in `initialize()` like so:
-```php
-$this->addBehavior('Tools.Jsonable', $config);
-```
-
-Tip: If you have other behaviors that might modify the array data prior to saving, better use a higher priority:
-```php
-$this->addBehavior('Tools.Jsonable', array('priority' => 11, ...));
-```
-So that it is run last.
-
 ## Examples
 ## Examples
 
 
 The behavior supports different input/output formats:
 The behavior supports different input/output formats:
@@ -120,4 +120,4 @@ Yes - you could make a new table/relation for this in the first place.
 But sometimes it's just quicker to create such an enumeration field.
 But sometimes it's just quicker to create such an enumeration field.
 
 
 Bear in mind: It then cannot be sorted/searched by those values, though.
 Bear in mind: It then cannot be sorted/searched by those values, though.
-For a more static solution take a look at my [Static Enums](http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/).
+For a more static solution take a look at my [Static Enums](http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/).