Drupal finally using OOP

Posted on

Finally. This is a huge step forward for Drupal. After eschewing OOP practices for a long time, its finally winning over core developers, which will make working with Drupal as a Framework easier in many ways. I copied the announcement below, but you can see that patch and discussion here.

Thispatch is about to be committed. It is the foundation to change for example $comment from an stdClass to a comment specific class allowing for $comment-\>save(). This is a monumental change and everyone is invited to review and familiarize with the new system even before it is committed.

What is possible when you use proper classes? The first thing I envision is a plugin/pluggable system in the same way that Zend Framework allows you to use Controller Plugins and View Helpers from a pluggable object, without the need to inherit or compose an object. For example, in a Zend View, you can call a partial like this:

// $this is a view instance
echo $this->partial('my-partial.html');

Now, the View class doesn't have a method named partial, instead the magic __call method intercepts the call, gets the Partial view helper, and calls its invoke method.

Tags: Drupal, PHP, Zend Framework

─── ✧ ─── ✦ ─── ✧ ───

Wait, Gingrich is the humane one?

Posted on

I scanned the results of the latest GOP debate and while it didn't turn up anything earth shattering, it speaks volumes that in the current GOP, Newt Gingrich is the humane voice. I'm not sure if he was ever an anti-imigration partisan, or if he's genuinely not a nice, likeable person. But when he led the Republican house in the 90s, I recall a lot of anit-immigrant sentinement too. In fact, its what finally motivated my family to get our U.S. Citizenship. For additional weirdness, lets create a "red card", which to most non-Americans, means you're getting expelled from a soccer game.

At Tuesday's Republican debate, Gingrich didn't call for making all illegal immigrants citizens, or even allowing all 11 million or so to stay in America, but for some who've been here for decades to get "red cards," establishing a special new class of non-citizens.

Gingrich Is Brave for Calling for the Humane Treatment of Humans

Tags: Family, Immigration, Politics, Soccer

─── ✧ ─── ✦ ─── ✧ ───

Grokking Zend Framework 2

Posted on

I've found these to be helpful in porting a ZF1 app to ZF2, which is in Beta1 status at the moment.  Rob Allen's tutorial -updated for the beta, worked for me out of the box using git submodule.  The programmers reference manual for groking new concepts, although sometimes it takes a couple of reads. Finally, looking at the code for the EdpUser module helped me figure out how to use DI and how to structure a functional module.

Once you start to understand the Dependency Injection container and the new Module bootstrap, in many ways its easier to get up and running than with ZF1.  I love that modules are first class citizens in the new MVC implementation.

Tags: Zend Framework

─── ✧ ─── ✦ ─── ✧ ───