Using Yii Framework, how can I access Model Constant in Controller?
Model.php
...
const STATUS_ACTIVE=1;
...
Controller.php
...
$criteria->condition = 'status='.self::STATUS_ACTIVE;
...
Error:
Fatal error: Undefined class constant 'STATUS_ACTIVE' in ... on line X
In your controller self is the controller's class who does not have this constant. I think you wanted:
Model::STATUS_ACTIVE
Where Model is the name of the model's class. ie:
$criteria->condition = 'status='.Model::STATUS_ACTIVE;