7. Putting it all together

So a common scenario would be retrieving data, manipulating the results and sending back to the database. Let's see with Eden's search, collection and model objects how we can acheive this.

Firgure 16. The Coolest Thing Ever!
//load database
eden('sqlite', SQL_FILE_PATH)
	//search user table
	//WHERE user_gender = $_get['gender']
	//ORDER BY user_id
	//LIMIT 75, 25
	//get a collection object
	//sets all users to active
	//Set a new column post_title
	->setPostTitle('A '.$_GET['gender'].'\'s Post')
	//Set a new column post_detail
	->setPostDetail('Content is King')
	//Copy the contents of user_id to a new column post_user
	->copy('user_id', 'post_user')
	//Set a new column post_created
	->formatTime('post_created', 'Y-m-d H:i:s')
	//save to user table
	//save to post table

If you look at our previous section B. PostGreSQL or even A. MySQL. You'll realize that it's the same documentation as this one with the exception of small changes basic query section. We normalized all SQL database objects to use the exact same thing to reduce the learning curve.

© 2012 Openovate Labs. All rights reserved.