summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Holywell <[email protected]>2013-01-25 11:14:29 +0000
committerSimon Holywell <[email protected]>2013-01-25 11:14:29 +0000
commit5a0bb6a42cc808bf6c6198ae45905c577470704c (patch)
tree50d9fbd38ea0eb40e5bed336d38ceb0ca91f3af2
parentb93b114426b997386231708f0816c2f590564791 (diff)
Add in a code sample to readme
-rw-r--r--README.markdown24
1 files changed, 23 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index a4cc843..9051b50 100644
--- a/README.markdown
+++ b/README.markdown
@@ -29,7 +29,7 @@ Documentation
The documentation is hosted on Read the Docs: [idiorm.rtfd.org](http://idiorm.rtfd.org)
-## Building the Docs ##
+### Building the Docs ###
You will need to install [Sphinx](http://sphinx-doc.org/) and then in the docs folder run:
@@ -37,6 +37,28 @@ You will need to install [Sphinx](http://sphinx-doc.org/) and then in the docs f
The documentation will now be in docs/_build/html/index.html
+Let's See Some Code
+-------------------
+
+ $user = ORM::for_table('user')
+ ->where_equal('username', 'j4mie')
+ ->find_one();
+
+ $user->first_name = 'Jamie';
+ $user->save();
+
+ $tweets = ORM::for_table('tweet')
+ ->select('tweet.*')
+ ->join('user', array(
+ 'user.id', '=', 'tweet.user_id'
+ ))
+ ->where_equal('user.username', 'j4mie')
+ ->find_many();
+
+ foreach ($tweets as $tweet) {
+ echo $tweet->text;
+ }
+
Changelog
---------