Articles tagged with "behavior"X
Displaying 1-7 of 7 result(s).

Auto-update denormalized attributes with MongoDb and Yii2

Created about a month ago by edoardo849Tips0 comments – viewed 1,561 times – version 2.0
You have different collections in MongoDb with de-normalized attributes. As you may know, due to its not-join nature, MongoDb tends to encourage repetition of the same value in different collections (de-normalization). In this MongoDb is opposed to a more SQL-like approach where you usually reference only the ID of the value with a foreign key.

How to implement an event and attach it in a behavior

Created about a year ago by seb7How-tos0 comments – viewed 7,928 times – ( +3 ) – version 1.1
This page explains how to implement an event and catch that event in a behavior.
tags: event, behavior

CGridView: Adding behaviors from configuration, and template items from behaviors to CGridView

Created about a year ago by le_topTips0 comments – viewed 5,829 times – ( +5 ) – version 1.1
Changing the way a CGridView is rendered from the configuration file, or through behaviors specified at the moment it is used, is handy to extend a CGridView without creating tons of different classes for it. I am surprised that this is not in the default implementation, so I made my default CGridView implementation.

Fixing extensions without modifying their code

Created about a year ago by schmunkTips3 comments – viewed 4,934 times – ( +6 ) – version 1.1
If you're working a lot with extensions you often stumble upon problems, when you want to include them into your custom web application, like hardcoded or absolute path aliases or classes extended from core application components, which implement addiditonal features.

Manage (Target) Language in Multilingual Applications + A Language Selector Widget (i18n)

Created 2 years ago by c@cbaTutorials10 comments – viewed 23,603 times – ( +14 ) – version 1.1
In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language. This tutorial shows a Yii-way of doing this. We implement an event handler for the onBeginRequest event; as the name of the event suggests, this event handler will be called at the beginning of each request, so its a good place to check whether a language is provided (via post, session or cookie) and set the application language accordingly. We also implement a simple Language-Selector Widget, which can render the language options as ajax-links or as a drop-down list.

Rendering a view file in a console application

Created 2 years ago by TompiHow-tos1 comment – viewed 6,699 times – ( +3 / -1 ) – version 1.1
When someone want to send formatted HTML mails from a console application she/he will probably come across the problem of rendering view files.

How to use an application behavior to maintain runtime configuration

Created 2 years ago by zaccariaHow-tos3 comments – viewed 21,335 times – ( +26 ) – version 1.1
In this tutorial will be explained a method to manage some configuration runtime. This excellent tutorial follows a similar approach, but requires to write a masterclass which all controllers are supposed to extend, following this wiki you can achieve the same by only editing the configuration.