Six signs of a passionate Software Developer

Hi All,

In this post I am going to tell you six signs of a passionate software developer. These six signs are purely based on the personal experience and you might still find one or more mutual points 🙂

1). You are a full time Software Developer, working Monday – Friday 9AM to 5PM but still can’t get your head away from coding even during weekends. You tend to find alternatives, better approaches and different techniques, for a function you wrote at work on Friday during the weekend. This is a clear sign that you are passionate about what you are doing.

2). You are at a party or a gathering but in your mind you are trying to memorise a foreign key / index that you knew it was kind not okay from the time you drew it in the ERD. You are restless until you figure out the most perfect / logical alternative. Another similar instance is, you named a foreign key / index which is very long and you think it might cause issues in different database platforms (exceeding the allowed character limit), so you are cutting letters in your mind.

3). You can’t concentrate on newspapers while travelling to / from work in a public transport. Apparently you want to browse a generic technology article on TechRadar or hunt down latest cool updates in your programming language ./ framework.

4). You badly want to reply your friend who said his programming language / framework is much more scalable and reliable than yours. Back in your mind you are collecting facts to prepare and strengthen your answer to blow off when you meet him next time. Continue reading

Share

Accessing SQL parameters and its values in DQL 2 in Symfony 2

Hi All,

When you are executing a DQL there must be situation where you might need to see the parameters and its values for the underlying SQL. Usually Doctrine queries are prepared statements and you will not be able to see the values which pass through the query. Prepared statement works in the following way,

  1. Sending the statement,
  2. Sending the parameters,
  3. And executing the prepared statement.
    (More information on prepared statements :- http://www.w3schools.com/pHp/php_mysql_prepared_statements.asp)

So, what you see when you get the SQL query is something similar to this,

 SELECT * FROM some_table WHERE column1 = ? AND column2 = ?

So today, I am going to show you a workaround to get the parameters (such as column1, column2 and so on…) and most importantly get the respective values for those parameters. Continue reading

Share

Symfony 2 fetching data using getRepository() and DQL

Hi folks,

Happy New Year !!!

Sorry I have been really busy past few months. I always wanted to continue my blog but the amount of workload I had to go through was immense. Fortunately, I found sometime to come up with a new post.

Well, this brief post is about the impact on fetching data mainly using getRepository and DQL (Doctrine Query Language), which you might have already known before. But I took some time out to highlight this fact, mainly for developers who are new to Symfony 2.x & Doctrine 2.x., which can heavily impact on performance on your Symfony application in long run.

Imagine you have 3 tables which are ‘users’, ‘user_roles’ and ‘user_categories’. There are unidirectional many-to-one relationships between ‘users’ to ‘user_roles’ and ‘user_roles’ to ‘user_categories’. Refer to Users.orm, UserRoles.orm and UserCategories.orm files below.

Continue reading

Share

Thoughts on data persist in Symfony 2

Hi All,

Today I will be discussing about persisting form submitted data in Symfony 2. Data persisting is all about inserting/updating records to/in a table in database. In this example I assume that you have a form ready which will contain few fields in order to insert values to the database. This is exactly what I am going to do in the following scenario. I will have a table (Entity) called ‘user_details (UserDetails)’. I will be passing some values from a form (which is not here) to the ‘insertUserDetails‘ action in ‘UserDetails‘ controller. Then using that action, I will be inserting new user details to the ‘user_details‘ table.

Well, in this post I would like to have an open ended discussion regarding data persisting. The approach you are using can be different from mine but still do the same intended job. More or less performance can vary, lines of codes can vary, efficiency can vary and so on.  You can see the controller and function below. First take a look at the code and I will explain the code below. Continue reading

Share

Accessing configuration parameters in Symfony 2

Hi,

Today, in this small post, I am going to show you how to access a parameter which is defined in config.yml file, inside the program.

Imaging you are creating/have a parameter called ‘is_something_enabled‘  inside config.yml. You need to access this parameter inside your code, let’s say inside a controller. This is how you do this. First of all let’s see how the parameter is defined in config.yml file.

parameters:
  is_something_enabled: true
Accessing this in a controller is very easy. Actually you don’t need to be in a controller to access these parameters. What you need is the container. If you can inject the container, to any of your class, that’s pretty much it. Here is how you access the above parameter in a controller,
$this->container->getParameter(‘is_something_enabled’);
In a container injected constructor class, this is how you access it. (Refer to my previous post to see how to inject the container to constructor)
Share