Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
class Post extends CActiveRecord
{
public function scopes()
{
return array(
'published' => array('condition' => 'published=1'),
);
}
}
Post::model()->published()->findAll();class Post < ActiveRecord::Base
named_scope :published, :conditions => { :published => 1 }
end
Post.published.allPostQuery::create()->filterByPublished()->find();
class_eval %Q{def #{ attr_name}=(value) ; @#{attr_name} = value ; end }use Nette\Mail; // вот это меня интересует
throw SmtpException('blah blah'); // и тут он найдет класс? Судя по их лоадеру нет, но может я не доглядел.
use Nette\Mail as Mail; // вот это меня интересует
throw Mail\SmtpException('blah blah'); // и тут он найдет класс? Судя по их лоадеру нет, но может я не доглядел.
Real programmers don't use frameworks. They write web applications through command-line straight to the server
use Nette\Forms\Form;
$form = new Form;
$form->addText('name', 'Name:');
$form->addPassword('password', 'Password:');
$form->addSubmit('send', 'Register');
echo $form; // renders the form
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('dueDate', 'date')
->getForm();SELECT `book_id`, `tag_id` FROM `book_tag` WHERE (`book_tag`.`book_id` IN (1, 4, 2, 3))$books = $database->table('book')->order('title')->limit(5);
$books[0]->related('book_tag');
The first query will be SELECT * FROM application. Then NotORM stores the information about used columns to the cache and all next requests will issue SELECT id, title FROM application. If you change the script and add more columns then one extra SELECT * will be issued and all next queries will be optimal again.
Nette PHP Framework: первое знакомство