DI ( Dependency Injection: Setter, Constructor, Method), AOP ( Aspect Oriented Programming ), Events support, xml, yaml, and annotations (including some JSR 250 and JSR 330, like @Configuration and @Bean ala java configuration) , lightweight, simple, and quick MVC ( Model View Controller ), syslog, tcp client and server, with non blocking sockets, custom error, signal, and exception handling through events. Needs PHP 5.3, very similar to seasar, spring ( java ) . Can be deployed as a PHAR file.
I think Marcelo had a copy of Zend Framework on his build machine when he wrote the tests. I tried installing Zend Framework by including it in composer:
Currently if you want to inject a property value into your bean's member variable with the @value annotation, you need to put the @value annotation on the private member variable's declaration:
class MyBean { /** * @Value(value=${app.properties.name} */ protected $name; }
If you want Ding to inject the value using a setter method you create the setter method with a name that matches the setter format set, with 's first character being uppercase:
public function setName($name) {
$this->name = $name;
}
}`
I would like it if Ding could inject property values if the @value annotation is on the setter method and not on the member variable declaration, like this:
`class MyBean {
protected $name;
/**
* @Value(value=${app.properties.name}
*/
public function setName($name) {
$this->name = $name;
}
}`
There are two justifications for this:
Consistency: When you inject resources using setter methods you can specify the @resource annotation on the setter instead of the member variable. Because of this I made the assumption that you could inject values using @value on the setter method and burned some time figuring out what was wrong.
Flexibility: There will be times when I don't want to save the value to a property. I might want to use the value as the input data for a more complex process. E.g. if I inject a comma separated string I might want to do something like this:
`class MyBean {
protected $nameList = [];
/**
* @Value(value=${app.properties.names}
*/
public function setNamesFromCsv($names) {
$this->nameList = explode(',', $names);
}