PHP talking to Magnolia CMS

I repost some of my blog posts made @ liip. Please see here for the original post and comments:

Since we started working on Jackalope, we always claimed it would also provide an integration point with other enterprise systems. Last week, we set out to proof this idea. Grégory Joseph of the Java based Magnolia CMS came to help us on the Magnolia side of things. Magnolia is using the JCR reference implementation Jackrabbit for storing its content. After an interesting exchange on their design decisions and our ideas, we started to hack.

Jackalope observation and import repository dumps

I repost some of my blog posts made @ liip. Please see here for the original post and comments:

Daniel Barsotti and me were reviewing the observation API of PHPCR and decided to just implement getting the observation journal. The journal contains all add, remove and update operations that happened on a PHPCR repository. You can also filter the journal by event type, path, node type and other criteria. This way, PHPCR can become almost a message queue (but just almost, there is no guaranteed delivery of messages).

Doctrine PHPCR-ODM now handles versioning

I repost some of my blog posts made @ liip. Please see here for the original post and comments:

The Doctrine PHPCR-ODM allows you to easily map your PHP objects onto content repository nodes. Since last week, the PHPCR-ODM leverages the versioning support of PHPCR in the ODM layer. This gives your application a very simple way to work with versioned content.

A colorful globe with the WS2801 LED strip

Looking for something nice that could be done with the WS2801 strips i bought, I came up with this idea to build a light globe. The arduino drives the strips and has a couple of programs it runs.

The best way to show how this all looks is probably some movies. (Beware, i used my cheap digicam to record, no high quality...). Some still pictures at the bottom.

The globe in action

Symfony2: Profiler trying to serialize objects or how to build your own router

The other day, i wanted to write a controller that expects an object as an action parameter, with the help of a custom router. Writing the router was as easy as adding a field to the array i return in the match() method. But then sometimes the controller has to send a redirection response. In production mode, everything works fine.
But in debug mode, i got a - very non-telling - error about serializing:

Notice: serialize(): "controller" returned as member variable from __sleep() but does not exist in
/home/david/liip/symfony-cmf/cmf-sandbox/vendor/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php line 30

Best of photos 2011

Auch dieses Jahr gab es viele interessante Gelegenheiten, Photos zu machen. Hier eine Auswahl der Bilder, die mir am besten gefallen.

Multilanguage support for Doctrine PHPCR-ODM

I repost some of my blog posts made @ liip. Please see here for the original post and comments:

Over the last weeks, Dan, Brian and myself worked on adding translation capabilities to Doctrine PHPCR-ODM. PHPCR-ODM is an object - document mapper for the php content repository (PHPCR). Thanks to the Liip Ecostar process, we got funding to do this during work time.

Symfony2 arrays as parameters in xml dependeny injection

Symfony documentation recommends to use XML for dependency injection configuration. I like the yml format because its simple and intuitive, but the main benefit of XML is the possibility for better validation and editing help.
So today we tried to port some configuration from yaml to xml.
Our yaml file contained an array parameter:

        en: [en, de]
        de: [de, en]

To make this work in XML, you need to nest parameter tags and use the type="collection" attribute.

    <parameter key="symfony_cmf_multilang_content.lang_preference" type="collection">
        <parameter key="en" type="collection">

International PHP Conference 2011: PHP Content Repository Specification

Conference: International PHP Conference / WebTech Con 2011
Title: PHP Content Repository Specification (joint talk with Lukas K. Smith)
Links: Slides,

The PHPCR specification defines an API that combines the power of NoSQL databases with hierarchical data structures and versioning, powerful search and other features. Content repositories, like Midgard2 or Jackrabbit, can implement the API to provide generic access to their content. Using PHPCR, applications can focus on the application logic and use the API to quickly implement CMS functionality.

Symfony2 controller as a service and the service_container

NOTE from 1.5 years later: This is not best practice. If you want a testable controller or write a reusable bundle, you should take the effort to inject the services you actually need, instead of extending the symfony base controller. For rapid development however, i would still recommend this as the base controller methods are very convenient.

I often want to have my controllers be a service so you can inject some information. But at the same time i like to extend the base controller Symfony\Bundle\FrameworkBundle\Controller\Controller to have the convenience methods like $this->render. Now if you just create a service from your controller, you won't be able to use the methods anymore. You will get exceptions about calling get() on a non-object.

Syndicate content