Horror of Yii2

I’ve made few years ago medium sized project in Yii and I was amazed how easy and fun it was. I’m not every day programmer so I felt empowered by Yii, felt that I could do with Yii a lot more than I would ever do with out it.

Now trying to do small one, just 9 tables. It took me a very long time just to import part of logic that was already used in previous project. I thought I will do all in just 7 days, instead importing 5 tables took me 2 weeks!

I feel really frustrated how hard Yii 2 became. In Yii 1 i spent few hours on reading docs and already understood how to tweak generated code to my needs. Just needed to look into docs for details here and there.

Now i can’t figure out how to do things that I have already done. The main reason behind it is bad documentation. It is really, really bad. It’s just terribly bad.

Examples? In Yii 1 you could throw in htmlOptions array anywhere and put html code there. Very simple. In Yii 2 sometimes it’s method content, sometimes HtmlContent and on top of this it’s not even mentioned in docs.

Now i’m trying to figure out how dataProvider works now, why it works with find(), but not with find()->all()?

How to make sorting? Docs states “The sorting object. If this is false, it means the sorting is disabled.” That’s broing stuff that inborn could guess. But how to configure it? On top of that i try to pass false to turn it off since i cant figure out how to use it. Simply passing ‘sort’ => false doesn’t work as well. It made me so frustraded that have to write this post.

I spent so much time to configure single date field with datepicker that it’s shame to mention.

Nightmare… Nightmare!

1 Like

/* snarky comment removed */

You can’t expect to go from Yii 1 to Yii 2 without putting some effort into it.

I understand that you are frustrated, but I think you should not underestimate the amount of mental shifting that moving from Yii 1 to Yii 2 involves.

jacmoe, that’s not useful…


Active data provider works with query (alike 1.1 criteria) i.e. what’s returned from find(). It modifies it accordingly to achieve sorting and pagination. Data is obtained via the modified query in the provider itself.

all() causes getting records themselves so despite the fact that you can use this data via array data provider, it’s very inefficient.

http://www.yiiframework.com/doc-2.0/guide-output-sorting.html. Also check the whole http://www.yiiframework.com/doc-2.0/guide-README.html#displaying-data.

That should work. Have you passed it to data provider instance?

most ppl goto laravel due to they had good documentation and lof of live example.
so viewer can quickly understand “how” to use.

imagine two car alongside,

  1. car 1 had clear documentation guide how to drive it, any newbie can quickly start the engine , but the car speed very slow (laravel)

  2. car 2 without sterling, wthout documentation, with only one advantage — fast speed, it also required newbie to see through whole car within to find out how to start the car engine…

which number better?
I prefer number 2 , but depends on when you guys going to make better documentation…?

Come on, dude - three years later? :wink:

My personal opinion:
I am satisfied with the documentation.
If you are not, simply improve it and submit a pull request.