Skip to content

Instantly share code, notes, and snippets.

View m4s0's full-sized avatar
🏠
Working from home

Marco Masotti m4s0

🏠
Working from home
View GitHub Profile
@ivan-ivanic-cm
ivan-ivanic-cm / symfony1.4-show-all-form-errors.php
Created August 3, 2012 09:05
Symfony 1.4 get all form errors.
<ul class="error_list">
<?php foreach( $form->getGlobalErrors() as $name => $error ) : ?>
<li><?php echo $name ?> : <?php echo $error ?></li>
<?php endforeach ?>
<?php $errors = $form->getErrorSchema()->getErrors() ?>
<?php if ( count($errors) > 0 ) : ?>
<?php foreach( $errors as $name => $error ) : ?>
<li><?php echo $name ?> : <?php echo $error ?></li>
<?php endforeach ?>
<?php endif ?>
@datacow-com
datacow-com / transaction.php
Created May 19, 2012 07:27
How to make transactions in Doctrine 2 using Symfony 2
<?php
// Snippet for Symfony 2 application that uses Doctrine 2 to handle transactions
// It uses the names of the objects/doctrine repositories from the Beta 4 Manual of Symfony 2.
// Get the entity manager
$em = $this->getDoctrine()->getEntityManager();
// suspend auto-commit
$em->getConnection()->beginTransaction();