Yii2: Tips & Tricks

yes, this one. It would be handy since it has favorites, tags and other things.

Very, very good initiative!

Congratulations.

I’m hoping that a repository of tips and complete and comprehensive code is created.

I’m planning to collect these and write a cookbook similar to the one for 1.1. This time it will be opensourced.

Nice job Orey and thanks for sharing this!

Maybe the Yii-team can create a git repository (yii2-cookbook) where people can submit PR´s with small recipes/examples like Orey have done here. The repository could compose primarily of files with markdown syntax (*.md). And then on each commit, the cook book is generated and published to the website (just as the documentation).

What do you think?

Done: https://github.com/samdark/yii2-cookbook

I’ll be your editor :)

Nice start.

Cool.

Probably I should learn git eventually, cause all the good stuff happens on github :)

Svn is totally outdated :(

Yeah. github is opensource everything ;)

You are fast as always Samdark ;)

Just found this: Gitbook.

Maybe it can be used to generate the book itself? Or would it be to much/complicated to start with?

exciting news for creating the yii2 cookbook . we need this :lol:

Interesting this, huh!

It’s starting to take a shape: https://github.com/samdark/yii2-cookbook/blob/master/book/index.md Come on, let’s do it!

Love the cookbook, these are very useful tips. I hope more people contribute…

Great job Orey and thanks for share code ;)

There are many scattered information.

Has guide, has the cookbook, has extensions, has Wiki, and have suggested a location only do more with code examples.

It would be great if all that was found in one location, well cataloged.

Cookbook isn’t wiki type where everything can end up. It’s more or less verified/edited so it makes sense to create it as a separate project.

This is great, but how do I set the users to have the roles of ‘moderator’ or ‘admin’?

You can create extra "role" field in users table.

PS. Notice that RBAC was rewritten heavily since that post.

This one is maybe known but, it may saves someone’s ass

in a query, you can also pass an array of data




$model->find()

->where(["col_name"=>["value1","value2","value3"]])

-all();



This will make a sql sentence ‘where in(…,…,…)’

I would really love if the yii2 cookbook would advanced, I think it’s a wonderful idea, as well as this post :)