Couchbase Datasource


I ran into a problem where I needed to utilize a NoSQL database. Since CakePHP is more fit for relational style database (MYSQL) I had to create a custom datasource (link). The following datasource allows models to have basic functionality of Couchbase Server.

Example Usage:

Setup / Configuration:

To use the couchbaseSource you must specify it in your model. Do so by adding the following.

You can also programmatically change datasouces / database on the fly. For example, sometimes I want to use my default MYSQL datasource. This can be accomplished like so:

To use be able to use this datasource it must be added to cakePHP list of available datasources.