1
1
ioDoctrineMenuPlugin
2
2
====================
3
3
4
+ Adds a data persistence layer to ` ioMenuPlugin ` . Create simple object-oriented
5
+ menus and then easily persist them to and retrieve them from the database.
6
+
7
+ This plugin also comes with an admin module to edit the menu items. The
8
+ admin module is complete with draggable ordering of the menu items.
9
+
4
10
The majority of the documentation can be found on the ` ioMenuItemPlugin `
5
11
[ http://github.com/weaverryan/ioMenuPlugin/tree/master/docs/ ] ( here ) .
6
12
7
- Quick documentation
8
- -------------------
13
+ Introduction
14
+ ------------
9
15
10
- Adds a data persistence layer to ` ioMenuPlugin ` . Create simple object-oriented
11
- menus and then easily persist them to and retrieve them from the database.
16
+ The core purpose of this plugin is to provide a persistence layer to the
17
+ ` ioMenuItem ` objects from the ` ioMenuPlugin ` .
18
+
19
+ ### Persisting menu items
12
20
13
- First, create a menu item and persist it to the database.
21
+ First, let's create a menu item and persist it to the database.
14
22
15
23
$menu = new ioMenuItem('root', '@homepage');
16
24
$menu->addChild('Sympal', 'http://www.sympalphp.org');
@@ -21,11 +29,23 @@ First, create a menu item and persist it to the database.
21
29
// persist the menu to the database
22
30
Doctrine_Core::getTable('ioDoctrineMenuItem')->persist($menu);
23
31
24
- Next, aasily retrieve the menu item from the database:
32
+ There is now a root menu item called ` root ` in the ` ioDoctrineMenuItem `
33
+ model with two children. This model uses Doctrine's nested set.
34
+
35
+ ### Retrieving menu items
36
+
37
+ Next, easily retrieve the menu item from the database. The resulting
38
+ ` $menu ` object is alightweight, easy-to-use ` ioMenuItem ` menu tree.
25
39
26
40
$menu = Doctrine_Core::getTable('ioDoctrineMenuItem')
27
41
->fetchMenu('root');
28
42
43
+ At this point, you can make changes to your ` $menu ` variable and then
44
+ re-persist to the database. The plugin will update any changes to the
45
+ nested set in the database.
46
+
47
+ ### Caching
48
+
29
49
Additionally, caching of the doctrine menu items is automatically handled
30
50
if you retrieve the menu items from the menu manager. For example, from
31
51
the actions:
@@ -41,6 +61,55 @@ caching:
41
61
<?php use_helper('DoctrineMenu') ?>
42
62
<?php $menu = get_doctrine_menu('admin') ?>
43
63
64
+ Installation
65
+ ------------
66
+
67
+ This plugin requires the ioMenuPlugin.
68
+
69
+ ### With git
70
+
71
+ git submodule add git://github.com/weaverryan/ioDoctrineMenuPlugin.git plugins/ioDoctrineMenuPlugin
72
+ git submodule add git://github.com/weaverryan/ioMenuPlugin.git plugins/ioMenuPlugin
73
+ git submodule init
74
+ git submodule update
75
+
76
+ ### With subversion
77
+
78
+ svn propedit svn:externals plugins
79
+
80
+ In the editor that's displayed, add the following entry and then save
81
+
82
+ ioDoctrineMenuPlugin https://svn.github.com/weaverryan/ioDoctrineMenuPlugin.git
83
+ ioMenuPlugin https://svn.github.com/weaverryan/ioMenuPlugin.git
84
+
85
+ Finally, update:
86
+
87
+ svn up
88
+
89
+ # Setup
90
+
91
+ In your ` config/ProjectConfiguration.class.php ` file, make sure you have
92
+ the plugin enabled.
93
+
94
+ $this->enablePlugins('ioMenuPlugin', 'ioDoctrineMenuPlugin');
95
+
96
+ Configuration
97
+ -------------
98
+
99
+ All configuration for this plugin can be found in the ` config/app.yml `
100
+ file packaged with the plugin.
101
+
102
+ The most important configuration options are those related to i18n. To
103
+ enable internationalization, be sure to set the following in your ` app.yml `
104
+ file:
105
+
106
+ all:
107
+ doctrine_menu:
108
+ use_i18n: true
109
+ i18n_cultures:
110
+ en: English
111
+ fr: Français
112
+
44
113
Care to Contribute?
45
114
-------------------
46
115
0 commit comments