Yii Framework Forum: Yii core classes will be namespaced? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii core classes will be namespaced?

#1 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 05 January 2012 - 07:07 PM

Yii framework classes are prefixed with letter C. Version 2.0 will use namespace and will remove C letter?
0

#2 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 05 January 2012 - 07:09 PM

Yes
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
1

#3 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 20 February 2013 - 09:24 AM

I was wondering if there will be a new best-practice way to extend classes with namespaces.
As an example, if I want to extend CHtml or \Yii\Html maybe.

class \MyNamespace\Html extends \Yii\Html {
   function myFunc(){
    ...
   }
}


If my namespace takes precedence I could use Html to access both objects.
Html::tag()

or
Html::myFunc()


Would this be a recommended way?
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,336
  • Joined: 17-January 09
  • Location:Russia

Posted 20 February 2013 - 11:50 PM

Yes.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   Suralc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 10-January 12
  • Location:Germany

Posted 22 February 2013 - 02:22 PM

View Postschmunk, on 20 February 2013 - 09:24 AM, said:

I was wondering if there will be a new best-practice way to extend classes with namespaces.
As an example, if I want to extend CHtml or \Yii\Html maybe.

class \MyNamespace\Html extends \Yii\Html {
   function myFunc(){
    ...
   }
}


If my namespace takes precedence I could use Html to access both objects.
Html::tag()

or
Html::myFunc()


Would this be a recommended way?


Or you could alias the classname to have a more obvious naming:

<?php
namespace My\Namespace;
use \Yii\Web\HTML as YHTML;
use My\Namespace\HTML as EHTML;
class HTML extends YHTML{

}

echo EHTML::tag();


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users