Yii Framework Forum: Get Behavior's Constant From An Action - Yii Framework Forum

Jump to content

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

Get Behavior's Constant From An Action Rate Topic: -----

#1 User is offline   Sergey_S 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 01-October 12

Posted 18 December 2012 - 11:26 AM

I created the behavior and attached it to a controller. In this behavior I have few constants.
How can I get this constants from an action?

self::CONST_NAME causes an error "Fatal error: Undefined class constant 'CONST_NAME'".

At the same time, if I create in behavior not a constant, but a public variable, then I can access this variable and all works fine. But I want to use constants.

Thanks.
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,057
  • Joined: 16-February 11
  • Location:Japan

Posted 19 December 2012 - 02:15 AM

View PostSergey_S, on 18 December 2012 - 11:26 AM, said:

self::CONST_NAME


YourBihavior::CONST_NAME ?
1

#3 User is offline   Sergey_S 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 01-October 12

Posted 19 December 2012 - 03:38 AM

View Postsoftark, on 19 December 2012 - 02:15 AM, said:

YourBihavior::CONST_NAME ?

Thank you! It works!
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