Thoughts after Symfony Live Berlin 2012

Lately XSolve team had a great opportunity to attend to Symfony Live conference in Berlin. That was our second chance to meet Symfony community after successful edition in London this year.

Germans are perfectly organized and they showed this to attendees this time. They’ve choosen very exciting venue, located in former church, with organs above main scene. Everything was right – place, seassions, food and party after last talk.

The most valuable part of this conference were talks. My favourite was “Symfony2 Form Tricks” by Bernhard Schussek, but also “What’s new in Doctrine2″ and “Practical REST”, were very interesting. What was very important – there weren’t any poor talk, which speaks for itself, if it comes to sessions quality.

To sum things up: Sensio Labs DE (the organizators) did they job very well and it was worth to have a such a good time in Berlin.

You can also find out ashort summary on XSolve’s profile and view some photos on Flickr

Read more

Is Symfony2 a MVC framework?

Is Symfony2 a MVC framework? This question in tricky and you can’t see answer at the first moment when you visit symfony.com website. Even more – MVC pattern isn’t mentioned in elevator pitches in “What is Symfony” section. Most of PHP developers will tell you promptly, that this is Model View Controller implementation without a doubt.

The question is: where is Model layer in Symfony2? My answer is: there’s ain’t one and it’s good..

Symfony2 isn’t hardly bounded with Model layer, as it could have been seen in first version. We can see many Active Record model implementations in modern web frameworks such as Ruby on Rails, Django and symfony 1. I’m not saying those solutions are bad. The main problem was, that big systems maintained by plenty of developers changing over time tends to have a messy codebase. The common place to locate business logic were Model layer. The result of that approach were huge model classes, randomly structured Table/Peer classes full of static method and general feeling that system is hardly impossible to maintain anymore.

The problem: complex systems

Nowadays Internet and business needs agile team working on sophisticated and higly complicated systems. Simple problems were solved years ago. If one wants to make a success with his web application, he needs to solve tough problems. Those systems are impossible to be produced with old fashioned Watterfall software development process. Something better fitting should taken into the consideration to adapt to current conditions. Most of development process can be covered by agile tools such a Scrum or Kanban.

All those cases, from architectural point of view, could be solved by Domain Driven Design

The solution: Domain Driven Design

It’s a approach and way of thinking about complex systems. It supports best known design patterns, good separation of concerns, agility and good communication layer between technical and business people, for example by using ubiquitous language.

So if you ask, where should I look for a Model in Symfony2 projects, I’ll tell you: look for it around the domain. Symfony2 has plenty of capabilities that could be used for developing system with DDD approach, I’ll name just a few of them.

Read more

Symfony Live London 2012 recap on xlab.pl

On xlab.pl blog I’ve posted summary and my feelings after Symfony Live London conference. Click here, to read it.

Read more

Always use most latest versions for benchmarks

In my previous post Modern framework comparison I presented performance tests, which compared Ruby On Rails, Django and Symfony2. After recieving a feedback in comments I decided to run this benchmark one more time on my own laptop (instead of on my hosting). The reason was simple: enviroment was outdated. I installed mod_python and configured it easily and struggled about one day with phussion passenger (AKA mod_rails) with ruby 1.9, but finally everything works. The results is compared in table below.

Read more

Why Mockery is better than PHPUnit Mock Builder and how to integrate it with Symfony2

Recently I did a lot of Test Driven Development on my Symfony2 bundle. I used PHPUnit’s built-in mocks and stubs for many projects, so I took it again. But while I was working on mocking Symfony2 core objects I found those mocks very uncomfortable in use. I tried Mockery and it saved my day. Let’s see how to get it working with Symfony2 and how it kicks ass!

Read more

Use Proxy-Object in Symfony2 applictions to test non-public methods

Generally, it’s not a good idea to unit test protected or private methods, but in some cases it could be useful. Of course we don’t want to change our class contract, and expose those methods as a public ones, just becasue we want to test them with PHPUnit. This case can be solved with Proxy-Object library. It provides easy-to-use way to get protected classes to the surface. More about that is here http://blog.bastian-feder.de/blog/029_proxyObject.html. Here I’ll show how to integrate proxy object into your Symfony2 application:

Read more

How to add a custom class to form field in Symfony2

Today I needed to add a custom class to textarea field, to achieve TinyMCE field rendering (with help of http://symfony2bundles.org/stfalcon/TinymceBundle). It wasn’t such straightforward like I thought… I tried:

But it threw exception, that attribute “class” is undefined, so I need to solve it in other way. Thank god I use Twig, so I tried form theming (in template with form). Only thing you need to do is to find out html ID of the textarea field (in my case: wowo_bundle_newsletterbundle_newslettertype_mailing_body). Then you need to add a “_” on the front and “_widget” on the end and class=”tinymce” is there for you.

The solution is simple and powerful, Symfony2 has proven its quality again :-)

UPDATE 19.10.2011
As Florian and Stloyd mentioned in comments, setting custom class can be done in elegant way, which ain’t included in the documentation yet.

UPDATE 29.10.2011

After my contribution, “attr” element is now documented in official Symfony2 docs http://symfony.com/doc/current/reference/forms/types/field.html

Read more

Loosening dependencies with closures in PHP

Today I ran into a little issue: how to pass generic logger object to method? I wanted to get some verbose output from method, which I call from Command, but onc time it should log with Symfony2 OutputInterface and other time it should use monolog logger. Of course I can make some wrapper class for both of them, but it would be kind of an overkill. The Closure from PHP 5.3 came with solution. In calling method I created closure like this:

On the second hand I’ve got:

As you can see I don’t need to care about logging – just call the closure with message and it will log it properly, depending on context.

Read more

Moja prezentacja o Symfony2 i dedykowanym oprogramowaniu z InternetBeta 2011

Poniżej slajdy z mojej prezentacji, którą wygłosiłem na InternetBeta 2011 w Rzeszowie. Zapraszam do zapoznania się z slajdami.

Read more

Prezentacja o Symfony2 i oprogramowaniu dedykowanym na InternetBeta 2011 w Rzeszowie

W czwartek 15 września 2011 o 14:30 będę miał przyjemność prowadzić prelekcję na Sesji Technologicznej InternetBeta 2011 w Rzeszowie. Mój temat to Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i dlaczego framework Symfony2 pasuje tu jak ulał? A poniżej krótka agenda:

  • - oprogramowanie dedykowane vs. produkty Open Source gotowe do użycia – w którym momencie te drugie przestają być wystarczające,
  • - jaką wartością jest indywidualne podejście do zagadnienia i gdzie każdy z udziałowców projektu otrzymuje największe korzyści,
  • - po co komu framework, skoro można wszystko samemu napisać najlepiej?
  • - Symfony2, jego historia, możliwości i usytuowanie na rynku,
  • - przykłady z życia codziennego, jak PHP i Symfony2 zwinnie daje radę w przeróżnych dziedzinach software developmentu.

Wszystkich zainteresowanych tematem serdecznie zapraszam :-)

 

Read more
older
Back to top