Yii Framework Forum: Yii::app()->controller->action->id not working - Yii Framework Forum

Jump to content

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

Yii::app()->controller->action->id not working Rate Topic: -----

#1 User is offline   moginn 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 315
  • Joined: 07-April 12
  • Location:Spain

Posted 28 December 2014 - 12:55 AM

Yii::app()->controller->id works fine when calling it from a view and from Controller.php

however

Yii::app()->controller->action->id
works fine when calling it from a view but doesn't work when calling from Controller.php. Yii::app()->controller->action returns null in Controller.php

why?
0

#2 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 585
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 28 December 2014 - 01:28 AM

How you are using it?

beforeAction
afterAction
init
beforeRender
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#3 User is offline   moginn 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 315
  • Joined: 07-April 12
  • Location:Spain

Posted 28 December 2014 - 02:01 AM

View PostPeRoChAk, on 28 December 2014 - 01:28 AM, said:

How you are using it?

beforeAction
afterAction
init
beforeRender


I am using it in the init() method of Controller.php
0

#4 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 585
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 28 December 2014 - 07:18 AM

Actions are not yet initiated in the init function

http://www.yiiframew...er/#init-detail

Also,

http://www.yiiframew...etAction-detail



thanks
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
1

#5 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 585
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 28 December 2014 - 07:21 AM

If you need, then you can use filters to check/set the data.
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#6 User is offline   moginn 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 315
  • Joined: 07-April 12
  • Location:Spain

Posted 28 December 2014 - 07:33 AM

View PostPeRoChAk, on 28 December 2014 - 07:18 AM, said:

Actions are not yet initiated in the init function

http://www.yiiframew...er/#init-detail

Also,

http://www.yiiframew...etAction-detail



thanks


ok, thanks for the information. Does this mean that is not possible to retrieve the action in the Controller.php?
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