samdark / yii2-cookbook

Yii 2.0 Community Cookbook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How about a FAQ as the last chapter?

markch123 opened this issue · comments

I quite like FAQs even if they are a bit antiquated :) And from the perspective of a lazy contributor its pretty easy to spend 5-10 minutes adding a question/answer to a list

Maybe its an idea to simply edit this comment with the list ? Rather then adding to the bottom of the thread and starting discussions on particular questions. Also another suggestion could be that each answer should be shortish 1/2 sentences and then a link to the official Yii2 guide (or cookbook!). If there is a better answer in SO then maybe the user guide should be updated or extended :)

The list of course could potentially get huge so at some stage would need to split into categories. But for now maybe just keep it simple. Actually maybe its just easier to start now and follow the Yii guide chapter structure :)

Application Structure
Where do I add js scripts
Handling Requests
How to extend controllers ?
How to dynamically add fields to form with validation ?
Key Concepts
Working with Databases

How do I add SQL functions such as now() into a ActiveRecord save operation.
Getting Data from Users
Displaying Data
Security
Caching
RESTful Web Services
Development Tools

Why composer returns error about bower
Testing
I want to integrate Yii2 into a CI. Do you have an examples using Jenkins or Travis
Special Topics
Does Yii2 have any performance metrics
Does yii2 support php7
I want to use Yii2 but my boss wants to know if it supports large sites, do you have any examples
Can I run Yii2 on HHVM
Widgets
How to properly refresh GridView in nested pjax component
How to remove label on radioList
How to change template on checkbox field
Whats a good example of a form password pattern
Is there a AJAX component
Helpers
How do I send mail

Let's do FAQ session right here and see where it leads to. Ask anything.

Is any example of layered architecture? Or something like

Is any example of layered architecture? Or something like

In general, it's out of scope of the framework and would look exactly the same no matter which framework is used. Many examples could be found searching for DDD.

Seems like there is no questions ))

It would be great to have something like that on the new Yii 2 website where you can add / edit questions and answers. StackOverflow is one of the main sources of perfect FAQ examples - countless times I've answered questions like "how to remove label on radioList?", "how to change template on checkbox field?", "why composer returns error about bower?" and so on...

We could just link to SO :)

True 😄 but not every question there can be answered in 1-2 sentences.

I have some questions/issues which I had workaround for now, but if you could give me a better way to do it would be nice:

  1. How to extend controllers ?
  2. How to dynamically add fields to form with validation ?
  3. How to properly refresh GridView in nested pjax component ?
  1. How to extend controllers ?

BController extends AController? Same as any other PHP class.

  1. How to dynamically add fields to form with validation ?

https://github.com/samdark/yii2-cookbook/blob/master/book/forms-activeform-js.md#adding-and-removing-fields-dynamically

  1. How to properly refresh GridView in nested pjax component ?

What's "nested pjax component"?

  1. Seems obvious but the problem is that the action you want to override returns already rendered string. So you cannot do anything from there on e.g. add/modify variables sent to view, render other view etc
  2. 10x for that :)
  3. Sorry about that - I tested it now and now it works, may be it was an old issue. By nested pjax I mean
<?php \yii\widgets\Pjax::begin() ?>
<h2>Nested pjax</h2>
<div>
    <?php \yii\widgets\Pjax::begin() ?>
    <?= \yii\grid\GridView::widget([...]) ?>
    <?php \yii\widgets\Pjax::end() ?>
</div>
<?php \yii\widgets\Pjax::end() ?>
  1. Seems obvious but the problem is that the action you want to override returns already rendered string. > So you cannot do anything from there on e.g. add/modify variables sent to view, render other view etc

If you need to override controller action, most probably, you're on a wrong way to a huge architectural mess. Extract contents of controller into domain layer, and call it from different controller actions.