Skip to content

Instantly share code, notes, and snippets.

View hollodk's full-sized avatar

Michael Holm hollodk

View GitHub Profile
mysql> select * from product; select * from category; select * from tag; select * from product_tag; +----+-----------+-------------+
| id | name | category_id |
+----+-----------+-------------+
| 1 | shampoo | 1 |
| 2 | skocreme | 1 |
| 3 | vase | 2 |
| 4 | hundesnor | 1 |
+----+-----------+-------------+
4 rows in set (0.00 sec)
mysql> select * from product; select * from category; select * from tag; select * from product_tag;
+----+----------+-------------+
| id | name | category_id |
+----+----------+-------------+
| 1 | shampoo | 1 |
| 2 | skocreme | 1 |
| 3 | vase | 2 |
+----+----------+-------------+
3 rows in set (0.01 sec)
@hollodk
hollodk / gist:6798350
Created October 2, 2013 18:32
Symfony2 get from repository class
Your controller:
/**
* @Route("/")
* @Template()
*/
public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
@hollodk
hollodk / gist:7a65372d691f3d60c217
Created December 21, 2014 14:23
Embed symfony forms without classes
$form = $this->createFormBuilder();
$registration = $this->get('form.factory')->createNamedBuilder('registration');
$questionary = $this->get('form.factory')->createNamedBuilder('questionary');
$registration
->add('name', 'text')
->add('city', 'text')
;
$questionary