Uncategorized

Doctrine 2 – Use foreign key as field in DQL

0

In doctrine 2 there are by default no foreign key fields a ID. For example your “product” entity might have a “shop” property, but no “shopId” property.

To get all the products that belong to a shop you would always have to make a join like this:

/* @var $em \Doctrine\ORM\EntityManager */ $result = $em->createQuery("SELECT p FROM My\Entity\Product p     JOIN p.shop s WHERE s.id = :shopId" )->setParameter('shopId', 1)  ->getOneOrNullResult();

But in certain situations it would be nice to use the foreign key column directly, in this case “shopId”. That More >

Cross browser border radius with CSS3 PIE

0

PIE stands for “Progressive Internet Explorer”. With PIE you don’t have to wait any longer to use the CSS3 border-radius property. A lot of browser already support it out of the box, but Internet Explorer only since version 9.

To also have support in Internet Explorer 6, 7 and 8 use PIE! There are two options for using it. With a htc behaviour file or with JavaScript.

Read more about it on the official website: http://css3pie.com/

Doctrine 2 i18n translatable extension

0

Doctrine 2 doesn’t have an i18n (internationalization) behaviour in the core anymore like Doctrine 1 had.

But luckily for us, Gediminas Morkevičius build the translatable behavior extension for Doctrine 2. Translatable behavior offers a very handy solution for translating specific record fields in diferent languages. Further more, it loads the translations automatically for a locale currently used, which can be set to a translatable listener on it’s initialization or later for other cases through the Entity itself.

Checkout the website: http://gediminasm.org/article/translatable-behavior-extension-for-doctrine-2

Go to Top