Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Forked from dhrrgn/user.php
Created December 4, 2010 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philsturgeon/728396 to your computer and use it in GitHub Desktop.
Save philsturgeon/728396 to your computer and use it in GitHub Desktop.
<?php
// Need to add 'activerecord' to your packages in config.php
namespace Fuel\Application;
use ActiveRecord;
class Model_User extends ActiveRecord\Model {}
<?php
/**
* Example Usage of the ActiveRecord Model.
* Associations do not currently work
*/
namespace Fuel\Application;
class Controller_Welcome extends Controller\Base {
public function action_index()
{
$user = Model_User::find(2);
echo $user->name;
$user->name = 'Jacob';
$user->save();
$user = new Model_User();
$user->name = 'Joe Smith';
$user->save();
echo $user->id; // 3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment