Author: rick
Date: 2010-03-18 13:59:44 +0100 (Thu, 18 Mar 2010)
New Revision: 28603

Modified:
   plugins/sfCouchPlugin/trunk/README
Log:


Modified: plugins/sfCouchPlugin/trunk/README
===================================================================
--- plugins/sfCouchPlugin/trunk/README  2010-03-18 11:35:52 UTC (rev 28602)
+++ plugins/sfCouchPlugin/trunk/README  2010-03-18 12:59:44 UTC (rev 28603)
@@ -9,18 +9,18 @@
 To install the plugin for a symfony project, the usual process is to use the 
symfony command line.
 You have to add the beta option as long as this plugin not stable.
 
-    $ symfony plugin:install -s beta sfCouchPlugin
+               $ symfony plugin:install -s beta sfCouchPlugin
 
-Alternatively, if you don't have PEAR installed, you can download the latest 
package attached to 
-this plugin's wiki page and extract it under your project's `plugins/` 
directory. Make sure the 
+Alternatively, if you don't have PEAR installed, you can download the latest 
package attached to
+this plugin's wiki page and extract it under your project's `plugins/` 
directory. Make sure the
 plugin is enabled in your project's /config/ProjectConfiguration.class.php if 
you install it
 manually!
 
-    $this->enablePlugins('sfCouchPlugin');
+               $this->enablePlugins('sfCouchPlugin');
 
 Clear the cache to enable the autoloading to find the new classes:
 
-    $ php symfony cc
+               $ php symfony cc
 
 Copy the file CouchDB.yml and the folder CouchDB from the plugin's config 
folder to the project's
 config-folder (/config)
@@ -37,28 +37,28 @@
 To create a new CouchDB document you can just instanciate a sfCouchDocument, 
set some key/value pairs
 and save it.
 
-    $newDoc = new sfCouchDocument();
-    $newDoc->type = 'myDoc';
-    $newDoc->data = array('Banana', 'Orange');
-    $newDoc->save();
-    
+               $newDoc = new sfCouchDocument();
+               $newDoc->type = 'myDoc';
+               $newDoc->data = array('Banana', 'Orange');
+               $newDoc->save();
+
 You can also create a document with an own id (instead of the autogenerated 
uuid)
 
-    $newDoc = new sfCouchDocument('mySuperId');
-  
+               $newDoc = new sfCouchDocument('mySuperId');
+
 If a document with this ID exists, it's fetched from the CouchDB and the method
 newDoc->isNew() returns false. That's the way to get a single document by ID 
from the db.
 
 Files can be attached to a document with:
 
-    $newDoc->attachFile($filePath, $fileName, $mimeType);
+               $newDoc->attachFile($filePath, $fileName, $mimeType);
 
 Only the first parameter is mandatory. If no fileName is given, the Name is 
derived
 from the file itself. If no mimetype is given it'll be 
'application/octet-stream'.
 
 Attachments can be loaded from a CouchDB document with:
 
-    $tempFilePath = $newDoc->getFile($fileName);
+               $tempFilePath = $newDoc->getFile($fileName);
 
 The file will be put in the webservers temp folder and the method returns the 
path of the
 temp file.
@@ -66,15 +66,15 @@
 If you want to have some more specialized documents just create a new model 
class that
 inherits sfCouchDocument.
 
-    class mySpecialDocument extends sfCouchDocument
-    {
-      // use this property to define keys that have to be set
-      protected $requiredProperties = array('type', 'name');
-      
-      ...      
-    }
-   
-   
+               class mySpecialDocument extends sfCouchDocument
+               {
+                       // use this property to define keys that have to be set
+                       protected $requiredProperties = array('type', 'name');
+
+                       ...
+               }
+
+
 Views
 -----
 
@@ -82,27 +82,27 @@
 
 To create a view just put a javascript file in the folder /config/CouchDB
 that is named VIEWNAME_map.js. If you also need a reduce function create 
another
-file named named VIEWNAME_reduce.js. There's an example view 'alldocs' in the 
+file named named VIEWNAME_reduce.js. There's an example view 'alldocs' in the
 distribution that returns all documents in the db and a map/reduce view called
 'example' that outputs the count of the digits 0-9 in the ids of your 
documents.
 
 Note: In production env the views don't get updated automatically. If you 
change a
 javascript you have to call the task couch:refreshViews.
 
-    $ php symfony couch:refreshViews
-    
+               $ php symfony couch:refreshViews
+
 Then call the view with sfCouchView::query($viewName, [$options]). The first 
parameter
-ist the VIEWNAME from the javascript files. 
+ist the VIEWNAME from the javascript files.
 
-    $result = sfCouchView::query('alldocs');
+               $result = sfCouchView::query('alldocs');
 
-The optional second parameter is an array with the CouchDB query options 
+The optional second parameter is an array with the CouchDB query options
 [See CouchDB 
wiki](http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options).
 
        $options = array('reduce' => false, 'include_docs' => true);
-    $result = sfCouchView::query('example', $options);
-    
-The result is an sfCouchResponse object that holds the returnes arrays. 
+               $result = sfCouchView::query('example', $options);
+
+The result is an sfCouchResponse object that holds the returnes arrays.
 You'll be interested in $result->rows.
 
 
@@ -110,4 +110,4 @@
 ----
 
  * Implement support for standalone files in CouchDB
- * Implement multiple key requests
\ No newline at end of file
+ * Implement multiple key requests

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to