200 likes | 316 Views
Welcome to the. London Yii Meetup. Hosted by Cass Surek – monthly meetings http:// www.meetup.com /London- Yii -Framework-Group/. Venue, beer and snacks kindly provided by . www.digitalannexe.co.uk. Tonight. Yii 2.0 overview – Cass Yii 2.0 add-on – Marian Zburlea. Yii 2.0.
E N D
Welcome to the London YiiMeetup Hosted by Cass Surek – monthly meetings http://www.meetup.com/London-Yii-Framework-Group/
Venue, beer and snacks kindly provided by www.digitalannexe.co.uk
Tonight Yii 2.0 overview – Cass Yii 2.0 add-on – Marian Zburlea
Yii 2.0 Current version 2.0.0 alpha Based on PHP 5.4.0 Incompatible with 1.1 Not yet ready for production Application templates (basic and advanced) Installation via Composer
Major changes Namespaces Component and Objects Events Path Alias View Class Models Controllers Widgets Console Applications i18N Action Filters Assets Static Helpers ActiveForm Query Builder ActiveRecord Auto-quoting table and column names User and identityInterface URL Management Themes Composer integration
Namespaces • Prefixes no longer used • Based on directory structuree.g. yii\web\Request
Components and Objects • CComponent split into Object and Component • Object – basic data structures • Component – events/behaviour
Object Config • Uniform way of configuring objects
Events • onEvent method definition no longer needed • $component->on($eventName, $handler);
Path Alias • Must use @ • @yii means Yii installation directory • Closely related to class namespaces
View Class • MVC • $this in a view no longer means controller or widget object • Smarty and Twig support added • Prado support removed
Models • formName() returns the form name (previously hardcoded) • Load() and loadMultiple() added to aid data population • New method: scenarios() to define which fields need to be validated • Safe validators discontinued, scenarios() define which are safe
Controllers • Render() and renderPartial() return content instead of sending it out • One must echo contents now
Widgets • Simplified process • Use begin(), end() and widget() instead of passing strings through beginWidget() and endWidget().
Themes • CThemeManager is gone • Path maps • ['/web/views' => '/web/themes/basic’] • /web/views/site/index.php will be /web/themes/basic/site/index.php • Any view file can have a theme, even if rendered outside of the context of a controller
Console applications • Controllers • Console and web controllers have same base class • Console controller is similar to CConsoleCommand
Internationalisation (i18n) • Date and number formatter are out • PECL intlphp module is in • I18n application component
Action Filters • Implemented via behaviors now