From 5a0bb6a42cc808bf6c6198ae45905c577470704c Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Fri, 25 Jan 2013 11:14:29 +0000 Subject: Add in a code sample to readme --- README.markdown | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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 --------- -- cgit v1.2.3