Skip to content

Instantly share code, notes, and snippets.

@ReactiveRaven
Forked from anonymous/Entity
Created December 17, 2012 16:49
Show Gist options
  • Save ReactiveRaven/4319737 to your computer and use it in GitHub Desktop.
Save ReactiveRaven/4319737 to your computer and use it in GitHub Desktop.
<?php
// src/Acme/SubscriptionBundle/Entity/Transaction.php
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
class Transaction
{
/**
* @Assert\Luhn(message = "Please check your credit card number.")
* @ORM\Column(type="string", length=255)
*/
protected $cardNumber;
/**
* @ORM\OneToMany(targetEntity="User", mappedBy="transactions")
* @Assert\NotBlank()
*/
protected $user;
/**
* @ORM\OneToMany(targetEntity="UserAddress")
* @Assert\NotBlank()
*/
protected $address;
/**
* @ORM\ManyToMany(targetEntity="Product")
* @Assert\Count(
* min=1,
* max=10,
* minMessage="Can't charge for an empty order",
* maxMessage="Order is too large, ten items or fewer"
* )
*/
protected $products;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment