Newbie question about AccessControl

Hi everyone,

my name is Jan, I am living in Germany and new to Yii. I have some experience with PHP, but not so much as an OO-language. I am a scientist, so programming is more a usefull hobby, than a profession.

Yii is my first PHP-framework. (worked a little in typo3 programming).

I started a project a couple of weeks ago with Yii 1.x and now try to switch to Yii 2.x.

I am currently trying to understand the Accesscontrol, which is confusing to me.

Can someone explain or drop me a link to a ressource why this piece of code does not work

class OrdersController extends Controller {

	public function behaviors() {

		return [ 

				'access' => [ 

						'class' => AccessControl::className(),

						'rules' => [ 

								// allow authenticated users

								[ 		'allow' => true,

			//							'roles' => [ '@'],

										'actions' => ['additem','index','view','index2','add2order','index3',] 



						// everything else is denied



				], 				'verbs' => [ 

						'class' => VerbFilter::className (),

						'actions' => [ 

								'delete' => [ 









	public function actionIndex3() {

		return (true);



	public function actionAdd2Order() {

		return (true);





I can access "actionIndex3" with orders/index3 but not "actionAdd2Order" by order/add2order. Latter gives me an 404.

I think it must be a very stupid error but it is driving me nuts for hours now…

Thanks again for any help.



Check this out:

"actionAdd2Order" probably translates into the URL "order/add2-order"

As I thought, simple and stupid…

You are completely correct. "Orders/add2-order" is the right route…