Skip to content

Constructor in Interfaces? Again no

Its a rainy day outside so i clicked (if it is clicking when you use CTRL+F ;-)) through the word wide web and found an entry by Ralph Schindler about PHP Constructor - Best Practise.

Ralph explained why

Strict standards: Declaration of Bar::somemethod() should be compatible with that of Foo::somemethod()
wont raise an error when you define another constructor signature in an extended class like
class \Foo { public function __construct(array $bar) { //put code in here } }

class \Bar extends \Foo { public function __construct(array $options, \foo $foo { //put code in herer } }

If you want to know why, click on the link and read the article :-).

What i liked most in his article was his consolidation of my one coding style by writing:

Moreover, constructors should not appear in interfaces.
as i asserted in an older entry.

But you really should read the whole article while he is talking about the prototype pattern. Also the comments can help you to forget the rain outside ;-).

Translate to de es fr it pt ja

tool - php 5.4

Since the PHP 5.3 update nightmare, i will wait a while before i update my version. But all in all there are three cool features inside, traits, short array syntax and DTrace. Since DTrace is something for "when my development sever is ready to run", short array syntax and traits are ready to use.

Short array syntax is pretty nice.

$foobar = ['foo' => 'bar'];

And traits, well we will see if it is good to use ore not. I like the fact that you can easily define one method and use it where you want. So it is more or less an interface with implementation. I will spare you from the general Singleton example here ;-).

But i can recommend the following links if you want to know more. <a href="" target="_BLANK" title="short array syntax in php 5.4 and netbeans - 120316>short array syntax Whats new in php 5.4.0 traits Migration from 5.3.x to 5.4.x

Translate to de es fr it pt ja

web - Zend Framework 2.0.0beta3 Released!

The Zend Framework community is pleased to announce the immediate availability of Zend Framework 2.0.0beta3. Packages and installation instructions are available at: [...] Featured components and functionality of 2.0.0beta3 include:
Refactored Config component All configuration readers have been moved under the Zend\Config\Reader namespace A Zend\Config\Factory has been added to simplify retrieving a config object from a config file Supported configuration formats now support importing additional configuration files All constant processing has been moved to a Zend\Config\Processor namespace, and expanded to be more powerful Work was provided by Ben Scholzen, Artur Bodera, Enrico Zimuel, and Evan Coury
New View layer New subcomponents include Zend\View\Model, Zend\View\Resolver, Zend\View\Renderer, and Zend\View\Strategy The old Zend_View class has been moved to Zend\View\Renderer\PhpRenderer, and rewritten to move most of its responsibilities into collaborators, greatly simplifying its design while simultaneously giving it more capabilities. A new class, Zend\View\View, allows selecting rendering strategies on a per-template basis, based on arbitrary criteria, and optionally injecting rendering results into a Response object MVC integration streamlines common use cases, including View Model creation and injection, 404 and error page creation, and more. Work was provided by Matthew Weier O'Phinney, with copious feedback from Rob Allen. Rewritten DB layer New architecture features low-level drivers, which also provide access to the PHP resource being consumed; adapters, which provide basic abstraction for common CRUD operations; new SQL abstraction layer, with full predicate support; abstraction for ResultSet's, with the ability to cast rows to specific object types; abstraction for SQL metadata; and a revised Table and Row Data Gateway. Work was provided by Ralph Schindler
New AgileZen component Support for the full AgileZen API Developed for use with our planning board Work was provided by Enrico Zimuel
PHP 5.4 Support A number of issues when running ZF2 under PHP 5.4 were identified and corrected.

I am happy the team managed to finished the view layer, the database support and the config :-D.

Translate to de es fr it pt ja