Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
b073aae4
Commit
b073aae4
authored
Apr 14, 2011
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some docs about extension conventions
parent
05d440f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
doc/extensions.rst
doc/extensions.rst
+29
-1
No files found.
doc/extensions.rst
View file @
b073aae4
...
...
@@ -16,7 +16,8 @@ on the application. ::
$app->register(new DatabaseExtension());
You can also provide some parameters as a second argument.
You can also provide some parameters as a second argument. These
will be set **before** the extension is registered.
::
...
...
@@ -26,6 +27,33 @@ You can also provide some parameters as a second argument.
'database.password' => 'secret_root_password',
));
Conventions
-----------
You need to watch out in what order you do certain things when
interacting with extensions. Just keep to these rules:
* Class paths (for the autoloader) must be defined **before**
the extension is registered. Passing it as a second argument
to ``Application::register`` qualifies too, because it sets
the passed parameters first.
*Reason: The extension will set up the autoloader at
extension register time. If the class path is not set
at that point, no autoloader can be registered.*
* Overriding existing services must occur **after** the
extension is registered.
*Reason: If the services already exist, the extension
will overwrite it.*
* You can set parameters any time before the service is
accessed.
Make sure to stick to this behavior when creating your
own extensions.
Included extensions
-------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment