Skip to content

Instantly share code, notes, and snippets.

@haswalt
Created December 2, 2011 10:18
Show Gist options
  • Save haswalt/1422693 to your computer and use it in GitHub Desktop.
Save haswalt/1422693 to your computer and use it in GitHub Desktop.
<?php
namespace \Acme\Bundle\ExampleBundle\Entity;
use \Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="product_variants", indexes={
* @ORM\index(name="variant_name_idx", columns={"name"})
* })
*/
class Variant
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=255, unique=true)
*/
protected $name;
/**
* @ORM\Column(type="string", length=255)
*/
protected $nameCanonical;
/**
* @ORM\Column(type="string", length=255, unique=true)
*/
protected $slug;
/**
* @ORM\Column(type="datetime")
*/
protected $createdAt;
/**
* @ORM\Column(type="datetime")
*/
protected $updatedAt;
/**
* @ORM\ManyToMany(targetEntity="Attribute")
* @ORM\JoinTable(name="product_variant_attributes", joinColumns={
* @ORM\JoinColumn(name="variant_id, referencedColumnName="id")
* }, inverseJoinColumns={
* @ORM\JoinColumn(name="attribute_id", referencedColumnName="id")
* })
*/
protected $attributes;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment