Form by_reference = true

if you are extending an entity, most of the time, you can ignore the by_reference field option. This is because it is set to true by default and its usually what you want.

for example

$formMapper->add('owner', 'entity', array(
                'class' => 'YourBundle:User',
                'multiple' => false,
                'required' => true,
                'label' => 'Gallery Owner'

This form field uses the variable “owner” as defined in the user class. it will call setOwner in the user class when the form is submitted before saving into the db.

Setting by_reference to false forces the framework to call the setter on the parent object instead. Since you are extending the parent entity, most of the time, you don’t want to touch the parent entity.

Regnerating bootstrap cache in symfony 2

if you accidentally delete the bootstrap cache ./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

Symfony: find all default global variables in twig

Twig ships with some default global variables that you can use. Where does this variables come from? You will see a Globals section. Take the ‘app’ variable for example, you can find all the variables available in that file. That is why {{ app.user }} works. To see all the variables in app.user, {{ dump(app.user) … Continue reading

Useful tools in chrome

chrome can be a really cool tool, not just a browser. Some cools extensions are: qsnap – for capturing and annotating screenshots. markdown viewer – for viewing markdown and auto refreshing if there are changes.

Install drush in cpanel

* you will need root access to the server If composer fails, it is most likely you dont have some extensions. If using cpanel, If all is working “drush core-status” should be working

Cleaning up git history with git rebase

Git rebase is good when you want to combine some historical commits into one commit. This might be a good idea because your history contains too many unncessary test commits, or if you want to cut down the size of your git objects. On the other hand, changing history can be a dangerous thing, it … Continue reading

bursa escort bayan

Selam ben Yildirim escort Ayse Butun yorgunlugunuzu alip siradan hayatinizi canlandiracak zihninizi butunescort bursa bayanlari escort mugla bayan tekirdag escort ilanlari olumsuzluklardan arindirip hayati size daha pozitif ve olumlu yasatacak buyulu bir elin sizi bu karanlik dunyadan kurtaracagi ani hala bekliyorsaniz buna artik son vermenizin zamani geldi hemen simdi beni arayarak monoton yasantiniza bir geceligine … Continue reading

Simple way to redirect user if Mobile

Javascript can detect screen size and redirect users if they are using mobile. I’ve found that checking the screen size and redirecting users based on that can cover 99% of the use cases rather than injecting some complicated browser detection javascript libraries. The screen width of IPAD is 768px and screen width of a bigger … Continue reading

The most time consuming part of software development process

People seem to think that the most time consuming and tedious part of developing a software is the coding of the software. This is wrong. The most tedious process is to get the right requirements for the project. Good business requirements without loopholes give good boundary of how the software will evolve. Screenshots and user … Continue reading

Software developer survival skills

To have a career as a developer, you need to have some important basic skill sets. All (new) technologies are built on top or around some commonly used technologies. People always say, “WOW, this technology is really hot now, you should learn it!”. Yes, but to even know the basics, it will take years to … Continue reading