Skip to content

Instantly share code, notes, and snippets.

@Javlopez
Created July 24, 2012 17:48
Show Gist options
  • Save Javlopez/3171466 to your computer and use it in GitHub Desktop.
Save Javlopez/3171466 to your computer and use it in GitHub Desktop.
Example controller for the Framework
<?php
use \ORM\Entrys;
use \Request;
class Home_Controller extends Controller {
public function actionDetail($id = null)
{
$request = new Request();
if ($request->isPost())
{
$idEntry = $request->getParam('id', Numbers::INT);
$entry = new Entrys();
$entry->where(array('id',$idEntry))
$entry->execute();
if ( ! $entry->load())
{
$this->request->isJSON();
throw new \Idea\Exception("Error Processing Request");
}
return $entry;
}
return View('errors/notFound',array('data' => 'mas mas mas') );
}
public function actionIndex()
{
$entry = new Entrys();
$entry->name = 'jaja';
$entry->Description = ''blabla;
$entry->save();
if($entry->saved())
{
Session::set('sb');
return new View('');
}
else
{
return new View();
}
}
public function actionList()
{
$entrys = new Entrys();
$entrys->getAll();
$entrys = new Entrys();
$entrys->select(array('a.field' => 'new name'))
$entrys->where(array('b.field = ?' => '7'));
$entrys->limit('20')
->find();
->find();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment