->select(['scope as value', 'scope as label', 'id as id']) // Это ваше
->select(['id as value', 'scope as label']) // А так для jui ac
SELECT * FROM table ORDER BY CASE WHEN salon_id = NULL THEN 1 ELSE 0 END;
SELECT * FROM Customers
ORDER BY CASE WHEN City = "London" THEN 0
ELSE 1
END;
И результат вроде тот, что вам нужен.type config map[string]interface{}
cfg := config{
"id": 123,
"components": config{
"user": "asd",
"db": config{
"user": "root",
"pswd": "pass",
},
},
}
//parse
rw := &sync.RWMutex{}
if u.Host == "" {
rw.RLock()
u.Host = Host
rw.RUnlock()
go func() {
for {
msg := <-queueParseUrlHtml
go func() { // <--------
extraFields()
вашей моделиThe extraFields() method defines additionally available fields which can also be returned by toArray() as long as you specify them via the $expand parameter.
try
, $activeCategory = NewsCategory::find()
->where(['name_en' => Yii::$app->request->get('category')])
->one();
if(!$activeCategory) { // Или ошибка
throw new NotFoundException();
}
$id = $activeCategory->id; // Иначе всё ок
как лучше хранить serialize, json, еще варианты?Грубо говоря json лучше и быстрее. Serialize удобнее, если пихать в бд объекты совственных классов, что вам скорее всего не нужно.
как лучше обратиться к данным модели формы?В модели написать метод типа
getDataAsModel(){...}
, который возвратит DynamicModel
составленную из вашего json_decode($this->data);
getDataAsModel(){...}
, вызвать валидацию и сунуть её в метод setMyDataModel($dinModel)
, который сделает что нужно и засунет $this->data = json_encode($data);
If you keep your code in a source repository somewhere, then you should use the root of that source repository as your base path. For instance, if you have a GitHub account at github.com/user, that should be your base path.
Note that you don't need to publish your code to a remote repository before you can build it. It's just a good habit to organize your code as if you will publish it someday. In practice you can choose any arbitrary path name, as long as it is unique to the standard library and greater Go ecosystem.