Skip to content

Instantly share code, notes, and snippets.

View baldurrensch's full-sized avatar

Baldur Rensch baldurrensch

  • Sourceability LLC
  • Irvine, CA
View GitHub Profile
{% form_theme form 'AcmeBundle:Default:designFormDesignOptionsTemplate.html.twig' %}
<fieldset>
<legend>Options</legend>
{{ form_errors(form.designOptions) }}
{{ form_widget(form.designOptions) }}
</fieldset>
@baldurrensch
baldurrensch / gist:3363772
Created August 15, 2012 21:21
Credit Card Validation
Acme\DV2Bundle\Model\CreditCard:
properties:
creditCardNumber:
- NotBlank: { groups: [flow_checkoutForm_step2]}
- MinLength: {limit: 15, groups: [flow_checkoutForm_step2]}
- MaxLength: {limit: 16, groups: [flow_checkoutForm_step2]}
creditCardCVV:
- NotBlank: { groups: [flow_checkoutForm_step2]}
- Regex: { pattern: "/^\d{3,4}$/", message: "Invalid CVV code", groups: [flow_checkoutForm_step2] }
getters:
@baldurrensch
baldurrensch / gist:3363726
Created August 15, 2012 21:12
Credit Card Unit Tests
<?php
namespace Acme\DV2Bundle\Tests\Model;
use Acme\DV2Bundle\Model\CreditCard;
class CreditCardTest extends \PHPUnit_Framework_TestCase
{
public function testMod10()
{
@baldurrensch
baldurrensch / gist:3363685
Created August 15, 2012 21:05
Credit Card Model class
<?php
namespace Acme\DV2Bundle\Model;
use Acme\DV2Bundle\Exception\UnsupportedCreditCardTypeException;
use Acme\DV2Bundle\Exception\UnknownCreditCardTypeException;
/**
* Acme\DV2Bundle\Entity\CreditCard
*/
@baldurrensch
baldurrensch / gist:3318103
Created August 10, 2012 21:23
HalResource Interface
<?php
namespace Hautelook\ApiBundle\Entity;
/**
* Hautelook\MainBundle\Entity\HalResource
* This interface should be implemented by all entities that are used in a Hal enabled JSON response.
* It standardizes the way to specify the resource rel and the links that should be added to the entities.
*
* @author Baldur Rensch <[email protected]>