Problem with namespace

Can anyone help me?

I started trying to use fresh namespace in my application, but did not understand the reason for the extended classes, maintain the same namespace for my class.

I’ve passed the full path to the cActiveRecod, but not resolved.




<?php

namespace modelo;

class sys_menu extends CActiveRecord

{

...




$model = application\models\modelo\sys_menu::model()->findByPk(1);

[color="#FF0000"]Fatal error: Class ‘modelo\CActiveRecord’ not found in [/color]

I am using the updated framework 1.1.5.

Hi Adonis, in PHP namespaces must be declared or used if they belong to the global scope.

E.g.


<?php

namespace modelo;

class sys_menu extends \CActiveRecord

{

...

or


<?php

namespace modelo;

use CActiveRecord;

class sys_menu extends CActiveRecord

{

...