![]() |
|
sfEnvironmentFixturesPlugin - 0.1.0Provides support for defining additional fixtures for each symfony environment. |
|
![]() |
8
users
Sign-in
to change your status |
Provides support for defining additional fixtures for each symfony environment. |
The sfEnvironmentFixturesPlugin is a symfony plugin that provides support for defining additional fixtures for each symfony environment.
The plugin does so in such a way that any symfony task which internally uses the data-load task will function in the same way.
| Name | Status | |
|---|---|---|
|
|
lead | moc.liamg <<ta>> vedbewme |
Copyright (c) 2010 Erin Millard
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.
| Version | License | API | Released |
|---|---|---|---|
| 1.0.2stable | MIT license | 1.0.0stable | 19/11/2010 |
| 1.0.1stable | MIT license | 1.0.0stable | 11/11/2010 |
| 1.0.0stable | MIT license | 1.0.0stable | 10/11/2010 |
| 0.1.4alpha | MIT license | 1.0.0stable | 10/11/2010 |
| 0.1.3alpha | MIT license | 1.0.0stable | 12/07/2010 |
| 0.1.2alpha | MIT license | 1.0.0stable | 12/07/2010 |
| 0.1.1alpha | MIT license | 1.0.0stable | 08/07/2010 |
| 0.1.0alpha | MIT license | 1.0.0stable | 08/07/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.2stable | MIT license | 1.0.0stable | 19/11/2010 |
| 1.0.1stable | MIT license | 1.0.0stable | 11/11/2010 |
| 1.0.0stable | MIT license | 1.0.0stable | 10/11/2010 |
| 0.1.4alpha | MIT license | 1.0.0stable | 10/11/2010 |
| 0.1.3alpha | MIT license | 1.0.0stable | 12/07/2010 |
| 0.1.2alpha | MIT license | 1.0.0stable | 12/07/2010 |
| 0.1.1alpha | MIT license | 1.0.0stable | 08/07/2010 |
| 0.1.0alpha | MIT license | 1.0.0stable | 08/07/2010 |
The sfEnvironmentFixturesPlugin is a symfony plugin that provides support
for defining additional fixtures for each symfony environment.
The plugin does so in such a way that any symfony task which internally uses
the data-load task will function in the same way.
Install the plugin (via a package):
$ symfony plugin:install sfEnvironmentFixturesPlugin-0.1.0a
Install the plugin (via a Subversion checkout):
$ svn co http://svn.symfony-project.com/plugins/sfEnvironmentFixturesPlugin/branches/0.1/ plugins/sfEnvironmentFixturesPlugin
Enable the plugin in config/ProjectConfiguration.class.php:
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins(array(
'sfEnvironmentFixturesPlugin',
));
}
}
The plugin will search the data directory (usually data)
for a sub-directory that follows the naming convention:
fixtures_<environment name>
For example, when running in the dev environment, fixtures will be
loaded from data/fixtures_dev.
Simply place the fixture files in the corresponding directories and they
will be loaded any time the data-load task is invoked.
You should see output similar to the following:
>> doctrine Loading data fixtures from "/path/to/project/data/fixtures"
>> fixtures Loading data fixtures for environment "dev"
>> fixtures Loading data fixtures from "/path/to/project/data/fixtures_dev"
>> doctrine Data was successfully loaded
The default environment for the data-load task is dev, so unless you
specify an environment with the --env option, fixtures in the
fixtures_dev directory will be loaded, which could be very bad in a
production environment.
Fixtures are always loaded from the main fixtures directory regardless
of the current environment.
Record labels must be unique across the main fixtures directory and the environment-specific one. This is because...
Environment-specific fixtures can still reference records in the main fixture file by label, making references easy to set up.
Fixtures are loaded in a recursive manner similar to the main fixtures directory, meaning you can have fixtures in subdirectories if you so desire.
Fixtures can still contain PHP code.
NOTE: This plugin has only been tested under Doctrine, however there is nothing Doctrine-specific about the plugin, so it should also work fine for Propel. If you have success or problems using this with Propel, please let me know.
