Framework build based on lithium (https://github.com/UnionOfRAD/lithium), integrating Twig as View layer and Doctrine as Model layer. Using Doctrine and Twig building web application become more intuitive.
- Clone the framework to your application directory e.g
git clone https://github.com/kiranatama/sagalaya.git app_dir - Change your connection setting (host/login/password/database) at
app/config/bootstrap/connections.php - Change default root url ('/') at
app/config/routes.php, default is redirected to Pages::view - Gain an overview with reading basic tutorial on running app
$user = new User($this->request->data);
if ($user->save()) {
$this->redirect('Users::index');
} else {
$errors = $user->getErrors();
}
return compact('user', 'errors');
$user = User::findOneById($id);
$other = User::get($other_id);
// access user repository
$lastUser = User::getLastUserLogin();
$users = User::findAll(array(
'where' => array(
'and' => array(
array('fullname' => array('neq' => 'someone')),
array('created' => array('gte' => '2010-10-10'))
),
'or' => array(
array('public' => array('eq' => true))
)
),
'leftJoin' => array(
array('field' => 'profile',
'leftJoin' => array(
'field' => 'nationality',
'where' => array(
array('name' => array('eq' => 'Indonesia'))
)
)
)
)
));
{{ user.fullname }}
created : {{ user.created.format('M d, h:i') }}
{% for user in users %}
{{ user.fullname }}, {{ user.email }}
{% endfor %}