Skip to content

Instantly share code, notes, and snippets.

View cristianoc72's full-sized avatar

Cristiano Cinotti cristianoc72

View GitHub Profile
@cristianoc72
cristianoc72 / propel.yaml
Last active March 21, 2022 20:32
Propel sample configuration file
## Sample Propel configuration file ##
propel:
## General settings ##
general:
# The name of your project.
# This affects names of generated files, etc.
project:
version: 2.0.0-dev
@cristianoc72
cristianoc72 / violationsToArrayFunctionTest.php
Created June 23, 2013 14:20
Unit test for violations_to_array function
<?php
require 'violations_to_array.php';
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
class ConstraintViolationListTest extends \PHPUnit_Framework_TestCase
{
protected $list;
@cristianoc72
cristianoc72 / violations_to_array.php
Last active January 14, 2022 22:07
Extract, from a ConstraintViolationsList object, an associative array where the keys are property names and values are error messages. This function was originally created to be used inside a Propel2 project. Anyway, it can be used in every project following the PSR-0 and using the Symfony Validator Component.
<?php
/**
* This function was originally created to be used inside a Propel2 project.
* Anyway, it can be used in every project following the PSR-0 and using the Symfony Validator Component.
*
* @see http://symfony.com/doc/current/book/validation.html
* @see https://github.com/propelorm/Propel2/blob/master/documentation/behaviors/validate.markdown
*/
use Symfony\Component\Validator\ConstraintViolationList;