Model_Client::count_by_last_name('corlett');
(returns the count of how many results were found)
if (Model_Client::count_all_by_last_name('corlett'))
{
// do something
}
<?php
namespace Article;
class Model_Article extends \ORM
{
protected $_belongs_to = array('news' => array(
'model' => 'Model_News'
));
}
<?php
namespace Article;
class Model_News extends \ORM
{
protected $_table_name = 'news';
protected $_has_one = array('articles' => array(
'model' => 'Model_Article'
));
}
<?php
namespace Article;
class Controller_Admin extends \Controller_Adminbase
{
public function action_index()
{
$articles = new Model_Article();
$articles->title = 'Theme Park Explodes';
$articles->datetime_create = 1298137190;
$articles->datetime_lastedit = 1298137190;
$articles->article = 'Here is some content';
$articles->author_create = 12;
$articles->author_lastedit = 12;
$articles->save();
$news = new Model_News();
$news->post_datetime = 1298137190;
$news->post_user = 43;
$news->save();
$news->add('article',$articles);
/*$this->content = \View::factory('articlehome')->render();
$this->title = 'Article Admin';
$this->draw();*/
}
}
bencorlett [at] me [dot] com
Fuel\Core\Autoloader::add_classes
Autoloader::add_classes
It looks like you're new here. If you want to get involved, click one of these buttons!