25 articles Symfony Page 2 / 5

Fabien Potencier is a mad genius, he’s the man behind Sensio Labs and the Symfony PHP framework, which I have grown to really appreciate. For one, any business with a web development team needs to be on a framework. Period. Collaboration will improve exponentially while development time will decrease as your systems become more stable and scalable. PHP frameworks are a necessity for any company with serious skin in the web!

Looking for a PHP developer, a Symfony expert or Wordpress web developer? Perhaps a business system architect that specializes in scalable MySQL business system design and deployment? We have reliable, fast and professional developers that meets your organization’s needs! Contact us for your next web development project and schedule a free consultation today.

Setting a Doctrine query limit in Sensio Lab’s Symfony PHP framework for customer queries in respositories

Here is an example of a simple DQL query in a custom repository method meant to return a single array result. The following will return the latest result in case there are multiple contact records that match the "customerId" field, which is actually "customer_id" in the database, but remember that camelCase convention applies to Doctrine…

PHP Symfony: Access the internationalization “locale”

In your controller, you can access the special global "_locale" variable from the Request object:  

Accessing cookies directly in your Symfony Twig views

In Symfony, cookies are stored in the app.request object. Here's how you access them in Twig: To see if a cookie is set, use the if statement inside Twig:

Symfony setting, adding or intercepting the public request object

In Symfony, you can alter the public request attribute from the $request object and set or add parameters. Example: You can also add new form fields and values with ->add:

Symfony & Doctrine: Using try… catch to determine success or failure of database insert or update action

In Doctrine, there is no simple way to access the Doctrine object and get the status of the last attempt at inserting or updating the database. To overcome this glaring limitation of the DBAL (Database Abstraction Layer), we have to resort to older PHP techniques like using a try... catch condition. Seems like a lot…