-
-
Save philsturgeon/728396 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
// Need to add 'activerecord' to your packages in config.php | |
namespace Fuel\Application; | |
use ActiveRecord; | |
class Model_User extends ActiveRecord\Model {} |
This file contains hidden or 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 | |
/** | |
* 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