BLOG

Reply to comment

Translating Symfony Terms for Drupal Devs

Last blog post I gave a digest what is a Symfony2 framework and why should Drupal Devs know about it. If you are reading this you probably already know PHP and Drupal and you got interested. Good news for you! You got everything you need to learn a modular PHP framework like Symfony2 fast. And climbing up the learning curve should not be too difficult for you.

So the next step would be navigate  to Symfony2 projects documentation. If you just want to invest 20min to check it out because of pure curiosity here is a few tips which make the process faster and it is like reading something you already know. This is because on the architecture and technical level between Drupal and Symfony2 there are many similarities - just the name of the concept differs. Beloved child has many names... Confusing vocabulary (maybe you know it from the Drupal world?) might slow down understanding the overall big picture.

Here is a little vocabulary for a Drupal developer to dealing with the confusing parlance:

  • Distribution = Release = Symfony2 is shipped in a distribution like Linux and Drupal calls this download a release. This means a package of confs and bundles. Enables default some features, bundles and 3rd party settings.
  • Bundle = Plugin = (Contributed) Module = Implements a single feature that extends the functionality of the framework. In Drupal these goes to usually to /sites/all/modules and in Symfony2 /vendor.
  • Vendor = Supplier of a PHP library or a bundle. In Drupal same as contributor. Sounds commercial but usually is not.
  • Router = Dispatcher = Menu system = Mapping system the makes the links between users request and the source/resource/code to be executed. Explained more lower level: maps internally URL (and request parameters) to the part of code to be executed.
  • A route = A map from a URL pattern to a controller/resource/object/part of code. 
  • Controller = Action = Hook = In Symfony2 this a PHP function you create that takes the request returns an HTTP response (as a Symfony2 Response object). In Drupal you create a hook which is executed in the given time that returns a value or directly manipulates other values. Between taking a request and returning value you can do what you want.

I still need to add that reading the glossary above, don't take everything as one to one 100% identical translation. In PHP terms it is more like == than ===. Just depending how low level are we investigating the the concept. For example when going deeper and specific to definition and analysis of Router/Menu system concept we will find differences. They implement the same process but the technique it does it differences. So how developer need implement his/her own logic differences and other system might give more flexibility to define a routing table. This why some concepts are not listed here because they may have my opinion ~95% similarity so they are a different thing. :) There is also other stuff that are the same like "Asset" === "Asset" so they are not listed here.

You will find the official Symfony2 specific glossary you should still check if my explanations did not make perfect sense for you. :) Please also remember to correct me if you find a better way to explain some concept. Or we could add some words to the list which is a similar concept in both systems.

Reply

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.