Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Yii 2   What’s new?




               Alexander Makarov,
                     Yii core team
Some statistics
Who uses Yii?
*intranet
2   2
Why?
1.Well-balanced
2.Stable
3.Flexible
4.Well-documented
2011 — beginning of 2012 events
What happened?
• 5 stable Yii 1.1 releases   • Events:
• Yii 1.1 Application           – Yii beer party
  Development Cook...
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.
• M...
*
              *                 *



       *                                          
2004       2005   2006   2007  ...
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 idea...
Documentation
—Larry Ullman, author of 22 excellent IT-books
 and a great article series about Yii will write a
 book abou...
Yii2: base
— Aliases in form of     class MyComponent extends
  @yii/base/Component    yiibaseObject
                     ...
Yii2: View Object
         —render(), widget(),
          beginCache() →
          viewObject
         —In a View: $owner ...
Yii2: events
$post->on('add',          • No need to
function($event) { ...      explicitly declare
});                    ...
Yii2: Query object

// Query object
$query = new Query;
$query->select('id')->from('tbl_customer')->limit(10);
$command = ...
Yii2: AR
$customer = Customer::find(2)   – Finder / Model
       ->active()               – Can create your own
       ->o...
Yii2: AR
$postFinder = Post::find()       – Criteria
  ->where(array(                 – Can merge two finders
    'active'...
Yii2: AR
                            class Customer extends ActiveRecord {
– tableName(),                      const STATU...
Yii2: AR
$customers =                 $customers =
Customer::find()->           Customer::find()->active()
asArray()->all(...
TODO (if there will be enough time)
•   HTTP (CURL) wrapper    • jQueryUI-based widgets
•   Package manager        • Comme...
1 or 2?



Don’t wait. Work with stable one.
When?
Before alpha code will be   •   Base for caching
put into public github      •   Base for i18n
repository we need to...
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
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
Upcoming SlideShare
Loading in …5
×

of

YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 1 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 2 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 3 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 4 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 5 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 6 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 7 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 8 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 9 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 10 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 11 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 12 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 13 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 14 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 15 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 16 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 17 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 18 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 19 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 20 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 21 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 22 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 23 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 24 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 25 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 26 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 27 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 28 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 29 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 30 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 31 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 32 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 33 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 34 YiiConf 2012 - Alexander Makarov - Yii2, what's new Slide 35
Upcoming SlideShare
Yii PHP MVC Framework presentation silicongulf.com
Next
Download to read offline and view in fullscreen.

17 Likes

Share

Download to read offline

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

Download to read offline

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

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

  1. 1. Yii 2 What’s new? Alexander Makarov, Yii core team
  2. 2. Some statistics
  3. 3. Who uses Yii?
  4. 4. *intranet
  5. 5. 2 2
  6. 6. Why?
  7. 7. 1.Well-balanced 2.Stable 3.Flexible 4.Well-documented
  8. 8. 2011 — beginning of 2012 events
  9. 9. 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
  10. 10. First two days —348 watches —61 forks
  11. 11. Now —1134 watches —240 forks
  12. 12. Yii 1.1.11 will be quite interesting release ;)
  13. 13. 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
  14. 14. * * * *  2004 2005 2006 2007 2008 2011 Prado, from 2004 → Yii 1.0, 2008 → Yii 1.1, 2010
  15. 15. Yii 2 team —3 active core developers: qiang, samdark, mdomba. —github.
  16. 16. —PHP 5.3.8+ —Better structure —All classes are —Less entities namespaced (yii) and —Keep good ideas w/o prefix —PSR-0 v2
  17. 17. 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.
  18. 18. 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' );
  19. 19. 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.
  20. 20. Yii2: events $post->on('add', • No need to function($event) { ... explicitly declare }); before raising • jQuery-like syntax $post->trigger('add', • Behaviors instead of new Event($this)); filters $post->off('add', $callback); $handlers = $post- >getEventHandlers('add' );
  21. 21. 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', ));
  22. 22. 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();
  23. 23. Yii2: AR $postFinder = Post::find() – Criteria ->where(array( – Can merge two finders 'active' => true – Can add conditions on )); the fly if($isPrivate) { $postFinder->addWhere(array( 'createdBy' => $userId, )); } $posts = $postFinder ->mergeWith($anotherFinder) ->all();
  24. 24. 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. }, ); } }
  25. 25. 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();
  26. 26. 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
  27. 27. 1 or 2? Don’t wait. Work with stable one.
  28. 28. When? Before alpha code will be • Base for caching put into public github • Base for i18n repository we need to • Controller + webapp finish at least these things→ • Base for widgets • URL manager
  29. 29. Want more info? —http://www.yiiframework.co m/forum/index.php/forum/4 2-design-discussions-for-yii- 20/
  30. 30. Questions? yiiframework.com yiiframework.ru rmcreative.ru
  • AekkapunSriwong

    Nov. 3, 2014
  • yiqing

    May. 21, 2014
  • fredchu

    Apr. 27, 2014
  • RafaelGarcia9

    Dec. 26, 2013
  • JackLaugh

    Jun. 1, 2013
  • leonardotumadjian

    Mar. 13, 2013
  • tanakataku

    Feb. 3, 2013
  • minhbang1

    Nov. 12, 2012
  • SelormNelson

    Nov. 8, 2012
  • ivanwhm

    Aug. 21, 2012
  • peterjkambey

    Aug. 11, 2012
  • amalsamally

    Aug. 10, 2012
  • quarkmarino

    Jun. 30, 2012
  • cebe-cc

    May. 31, 2012
  • gezimrugova

    May. 31, 2012
  • mooxos

    May. 31, 2012
  • tanakahisateru

    May. 30, 2012

Views

Total views

20,147

On Slideshare

0

From embeds

0

Number of embeds

5,082

Actions

Downloads

244

Shares

0

Comments

0

Likes

17

×