Difference between #8 and #9 of
Yii registry, how to use it, does it exist at all?

Revision #9 has been created by dckurushin on Oct 13, 2011, 7:44:21 PM with the memo:

global state
« previous (#8) next (#10) »

Changes

Title unchanged

Yii registry, how to use it, does it exist at all?

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

Zend_Registry, registry, params, CMap, magic, get, set

Content changed

[...]
return array(
'abc' =>123,
);
```

Addition 1: Yii global state
 
----------------------------
 
 
The params array, can be good registry for the current life cycle.
 
but yii also has something called "globalstate", it allow you save the data "forever"
 
 
CApplication has 3 methods:<br>
 
**getGlobalState**(string **$key**, mixed **$defaultValue**=NULL)<br>
 
**setGlobalState**(string **$key**, mixed $value, mixed **$defaultValue**=NULL)<br>
 
**clearGlobalState**()<br>
 
 
every thing you set via setGlobalState will be saved in runtime/global.bin in serialized form
 
 
Some common component that use it is CSecurityManager for validation key
 
 
Links ----- [Russian version](http://resurtm.kz/registry-in-yii)
6 0
9 followers
Viewed: 36 991 times
Version: 1.1
Category: How-tos
Written by: dckurushin
Last updated by: resurtm
Created on: Sep 24, 2011
Last updated: 11 years ago
Update Article

Revisions

View all history