Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Join this plugin team

Changelog for release 1.0.2 - 05/05/2009

Other releases

Release 1.0.2 - 05/05/2009

sfAspectPlugin (for symfony 1.2)

The sfAspectPlugin allows you implement symfony aplication using the paradigm of Aspect oriented programming.
This plugin was implemented using the classes library located in PHP Classes, but some changes were made to adapt it to symfony framework.

Installation

To install the latest release, execute:

> symfony plugin:install sfAspectPlugin

or to install the current revision, checkout the HEAD revision into a plugins/sfAspectPlugin folder:

> svn co http://svn.symfony-project.com/plugins/sfAspectPlugin

Now let's configure plugin.

Configuration

config_aspect.yml

The first thing you must do, is to create a folder with name "aspect" within of the folder "config" of the project. Within "aspect" folder, you must put a file with the name "config_aspect.yml". The structure of this file is similar to file "autoload.yml". There is an example of this file bellow.

aspect:
project: # Entrance of configuration, the name depends on the
# developer appropriateness, it's just a label.
path: %SF_LIB_DIR% # Path of the folder where classes are found to which
# aspects must be applied . To give value to path you
# can take the file "autoload.yml" as example.
recursive: on # If it is set in "on" all classes in subdirectories
# will be processed , but if it is set in "off" only
# the classes in the root directory will be processed.
exclude_dir: [model] # Name of the subdirectories must be excluded. In this
# case the "model" folder is excluded, If nothing
# is put, no subdirectories will be excluded.
exclude_class: [] # Name of classes must be excluded, in this case any
# class is excluded.
file_aspect: [] # Name of Files which contain the aspect that must be
# applied, if nothing is specified,all the aspects
# will be applied declared in file ".xml" in folder
# "config/aspect". If you put a name to the file, you
# must not put the extension ".xml"

Definition of aspects

The definition of aspects must be put in XML file, located in the folder "config/aspect" of the project. You can create as many files XML as you needed. a simple example is given bellow.

Example

Suppose we have a class located in the directory "lib/" of the project with name "TestAspect" with this statement.

In a XML file located in the folder "config/aspect", you must declare the aspect that must be applied to the classes. This file can have any name, in this case we will put "debugger.xml". the declaration is given bellow.