Created
September 6, 2011 12:34
-
-
Save fabriziomachado/1197425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Welcome extends CI_Controller { | |
function __construct() { | |
parent::__construct(); | |
$this->load->spark('php-activerecord/0.0.1'); | |
} | |
public function index() { | |
$user = new User(array("email_address" => "[email protected]")); | |
$user->save(); | |
## This should show you the User record that you just created | |
print_r($user); | |
## Now do a simple find by email address | |
$user = User::find_by_email_address("[email protected]"); | |
print_r($user); | |
## Now do a simple find by primary key | |
$user = User::find(1); | |
print_r($user); | |
$this->load->view('welcome_message'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment