• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
YiiConf 2012 - Alexander Makarov - Yii2, what's new
 

YiiConf 2012 - Alexander Makarov - Yii2, what's new

on

  • 16,139 views

 

Statistics

Views

Total Views
16,139
Views on SlideShare
11,873
Embed Views
4,266

Actions

Likes
16
Downloads
212
Comments
0

37 Embeds 4,266

http://desphpparatodos.blogspot.com.es 1747
http://desphpparatodos.blogspot.com 837
http://www.desphpparatodos.blogspot.com 533
http://desphpparatodos.blogspot.mx 357
http://www.linkedin.com 210
http://www.desphpparatodos.blogspot.mx 137
http://desphpparatodos.blogspot.com.ar 123
http://www.desphpparatodos.blogspot.com.ar 115
http://www.desphpparatodos.blogspot.com.es 88
http://loc.yiiframework.com.ua 49
http://desphpparatodos.blogspot.ru 10
http://www.techgig.com 10
http://desphpparatodos.blogspot.de 5
http://desphpparatodos.blogspot.cz 4
http://desphpparatodos.blogspot.com.br 4
http://desphpparatodos.blogspot.it 4
http://desphpparatodos.blogspot.ca 4
https://twitter.com 3
http://feeds.feedburner.com 3
http://desphpparatodos.blogspot.co.uk 3
http://desphpparatodos.blogspot.fr 3
http://www.nitroni.com 2
http://115.112.206.131 1
http://www.desphpparatodos.blogspot.ca 1
http://www.desphpparatodos.blogspot.co.uk 1
http://desphpparatodos.blogspot.ch 1
http://webcache.googleusercontent.com 1
https://abs.twimg.com 1
http://www.desphpparatodos.blogspot.fi 1
http://www.desphpparatodos.blogspot.it 1
http://desphpparatodos.blogspot.in 1
http://www.desphpparatodos.blogspot.in 1
http://www.desphpparatodos.blogspot.ch 1
http://www.desphpparatodos.blogspot.fr 1
https://si0.twimg.com 1
http://desphpparatodos.blogspot.nl 1
http://desphpparatodos.blogspot.jp 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    YiiConf 2012 - Alexander Makarov - Yii2, what's new YiiConf 2012 - Alexander Makarov - Yii2, what's new Presentation Transcript

    • Yii 2 What’s new? Alexander Makarov, Yii core team
    • Some statistics
    • Who uses Yii?
    • *intranet
    • 2 2
    • Why?
    • 1.Well-balanced2.Stable3.Flexible4.Well-documented
    • 2011 — beginning of 2012 events
    • What happened?• 5 stable Yii 1.1 releases • Events:• Yii 1.1 Application – Yii beer party Development Cookbook – YiiTalk• Yii for Eclipse PDT, – YiiConf CodeLobster• Yii → GitHub
    • First two days—348 watches—61 forks
    • Now—1134 watches—240 forks
    • Yii 1.1.11 will be quite interesting release ;)
    • What’s bad in Yii 1.1?• AR (finder and record are the same object, some API).• Some classes are in strange places.• More small things. The biggest issue is BC
    • * * * * 2004 2005 2006 2007 2008 2011Prado, from 2004 → Yii 1.0, 2008 → Yii 1.1, 2010
    • Yii 2 team—3 active core developers: qiang, samdark, mdomba.—github.
    • —PHP 5.3.8+ —Better structure—All classes are —Less entities namespaced (yii) and —Keep good ideas w/o prefix—PSR-0 v2
    • Documentation—Larry Ullman, author of 22 excellent IT-books and a great article series about Yii will write a book about Yii2 + will participate in official documentation writing.—API docs will be at least same quality as 1.1.—Code style guide.—There’s a plan to release documentation tool to the public.
    • Yii2: base— Aliases in form of class MyComponent extends @yii/base/Component yiibaseObject {— CComponent → public $x; Object + Component public function __construct($a, $b)— SPL replaced most of { collections //… }— Removed } CFormModel. Now you can use Model $component = MyComponent::newInstance( directly. array(x=>10), a, b );
    • Yii2: View Object —render(), widget(), beginCache() → viewObject —In a View: $owner = class that uses view —$this = View. —No need for renderer. —Can be used in console applications. —CHtml is still there.
    • Yii2: events$post->on(add, • No need tofunction($event) { ... explicitly declare}); before raising • jQuery-like syntax$post->trigger(add, • Behaviors instead ofnew Event($this)); filters$post->off(add,$callback);$handlers = $post->getEventHandlers(add);
    • Yii2: Query object// Query object$query = new Query;$query->select(id)->from(tbl_customer)->limit(10);$command = $db->createCommand($query);$this->assertEquals("SELECT `id` FROM `tbl_customer`LIMIT 10", $command->sql);// array$command = $db->createCommand(array( select => name, from => tbl_customer,));
    • Yii2: AR$customer = Customer::find(2) – Finder / Model ->active() – Can create your own ->one(); finder$customer->name = Qiang; – ::model()$customer->save(); – Auto quoting.$customers = Customer::find() – Method chains. ->order(id) ->asArray(true) ->all();
    • Yii2: AR$postFinder = Post::find() – Criteria ->where(array( – Can merge two finders active => true – Can add conditions on)); the flyif($isPrivate) { $postFinder->addWhere(array( createdBy => $userId, ));}$posts = $postFinder ->mergeWith($anotherFinder) ->all();
    • Yii2: AR class Customer extends ActiveRecord {– tableName(), const STATUS_ACTIVE = 1; relations(), scopes() = public static function tableName() { static. return tbl_customer;– Relations are } HAS_ONE, public static function relations() { HAS_MANY. return array( orders:Order[] => array(– link = FKs => id), link => array(customer_id– via = through ); ),– Anonymous functions } for scopes. public static function scopes() {– "@." and "?" tokens: return array( active => function($q) { own table, external return $q- >andWhere(@.`status` = . self::STATUS_ACTIVE); table. }, ); } }
    • Yii2: AR$customers = $customers =Customer::find()-> Customer::find()->active()asArray()->all(); ->all();foreach (Customer::find() $customers =as $customer) Customer::find() ->where(name like :name,$count = Customer::count() array(->value(); :name => %customer%‘ ))->order(id)->all();
    • TODO (if there will be enough time)• HTTP (CURL) wrapper • jQueryUI-based widgets• Package manager • Commercial support• Mailer• Twitter Bootstrap• Debug toolbar• Console requirements• More helpers
    • 1 or 2?Don’t wait. Work with stable one.
    • When?Before alpha code will be • Base for cachingput into public github • Base for i18nrepository we need to • Controller + webappfinish at least thesethings→ • Base for widgets • URL manager
    • Want more info?—http://www.yiiframework.co m/forum/index.php/forum/4 2-design-discussions-for-yii- 20/
    • Questions?yiiframework.com yiiframework.ru rmcreative.ru