Development

/plugins/sfConstPlugin/README

You must first sign up to be able to contribute.

root/plugins/sfConstPlugin/README

Revision 3876, 1.5 kB (checked in by Jonathan.Wage, 6 years ago)

sfConstPlugin: Initial import.

Line 
1 = sfConst plugin =
2
3 The `sfConstPlugin` is a symfony plugin that provides app wide constants functionality.
4 It automatically generates constant values based on sf_const table values and make them accessible in every app module.
5 This plugin's functionality is quite similar to sfSettingsPlugin functionality. The difference is that this plugin
6 automatically generates unique constant names based on constant name and reference to pair of table/field.
7 Plugin can be helpfull if you have a big number of reference tables like statuses, types, etc and don't want to
8 create atomic tables for each table reference.
9
10 == Installation ==
11
12   * Install the plugin
13  
14   {{{
15     symfony plugin-install http://plugins.symfony-project.com/sfConstPlugin
16   }}}
17  
18   * Enable module in your `settings.yml`
19     * sfConst
20
21   {{{
22     all:
23       .settings:
24         enabled_modules:      [default, sfConst ]
25   }}}
26
27   * Clear you cache
28  
29   {{{
30     symfony cc
31   }}}
32
33 === Manage constants ===
34
35   * Access the constants management module with the default route:
36  
37   {{{
38     http://www.example.com/backend.php/sfConst
39   }}}
40
41
42 === Use constants in your application ===
43
44 To use constants from sf_setting table in a symfony project:
45
46   * Put the following line into your main controller symfony file (i.e. index.php, frontend_dev.php, backend.php, etc)
47
48       include_once (sfConfigCache::getInstance()->checkConfig('config/db_const.yml'));
49
50   * You're done.
51
52 == TODO ==
53
54   * created_user_id, updated_user_id - implement this functionality so table remembers who has changed the values
Note: See TracBrowser for help on using the browser.