How to choose where to enable a plugin in symfony 1.x?
In symfony 1.x, you can enable a plugin in the project configuration and in the each application.
A good rule of thumb could be to put common plugins in the project configuration, as they are shared accross all applications, and specific ones in the concerned applications… but it’s not!
In fact, some problems may occur with the symfony tasks as they use sometimes the first application they find, and sometimes no application at all, so most of the time the applications plugins are not available for command line tasks.
This is particularly annoying for
plugin:publish-assets which must publish the assets of all plugins, or
propel:build-model which needs the
schema.yml files of all plugins too.
So the true real good rule of thumb is to enable all the plugins needed by any task in the project configuration, and then to sort the remaining plugins following the first rule above.
Symfony 1.x - Route loading and evaluating order
Routes are loaded and evaluated in this order:
- $routing->prepend(…) in Plugin
- $routing->prepend(…) in Application
- routing.yml in Plugin
- routing.yml in Application
- $routing->append(…) in Application
- $routing->append(…) in Plugin
If 2 routes match the same URL, the first one following this list will be chosen.
Note: connect() and append() are the same function
sfPropel15Plugin: Cannot redeclare echoln() (Previously declared in…
The issue is discussed on the sfPropel15Plugin Github account.
François Zaninotto closed it although it should considered as a “won’t fix” as this is really a Propel bug and not a Symfony one.
I think it is a Propel as
sfYaml.php without class existence check.
To temporally avoid this bug,
PropelYAMLParser.php must be copied to the
/lib directory of the Sf project and the require_once must be commented.
// require_once dirname(__FILE__).'/yaml/sfYaml.php';
The sfYaml class is then autoloaded by Symfony only once.
Attribute - Property - Variable - Parameter - Argument
Many differents words can name values and placeholders in programming languages.
Here are the differences, with a simple PHP example.
<?php function first($a, $b) // parameters
$foo = new StdClass(); // variable
$foo->bar = 'baz'; // property
echo first(2, $foo); // arguments
// There is no real attribute in PHP
$tmp = new SplFileInfo("/tmp");
echo $tmp->isWritable(); // attribute (a metadata placed on an "object", not a property inside of it)
plugin:publish-assets is environment dependant: symfony loads just the project configuration, and plugins enabled in the project are the only ones which get published.
Nothing to do to change this.
Propel error : “Duplicate table found: propel.”
- a duplicate
generated-schema.xml exists somewhere in your plugins
- an emplty
generated-schema.xml exists somewhere