Skip to content

Instantly share code, notes, and snippets.

@rvanlaak
Created March 7, 2014 11:04
Show Gist options
  • Save rvanlaak/9409592 to your computer and use it in GitHub Desktop.
Save rvanlaak/9409592 to your computer and use it in GitHub Desktop.
FpnTaggingBundle complete entities. The getters/setters are inherited via the parents
<?php
namespace Acme\AppBundle\Entity\Tag;
use FPN\TagBundle\Entity\Tag as BaseTag;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="acme_tag")
* @ORM\Entity(repositoryClass="Acme\AppBundle\Entity\Tag\TagRepository")
*/
class Tag extends BaseTag
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
* @ORM\Column(name="name", type="string", length=50)
*/
protected $name;
/**
* @var string
* @ORM\Column(name="slug", type="string", length=50)
*/
protected $slug;
/**
* @var \DateTime
* @ORM\Column(name="created_at", type="datetime")
*/
protected $createdAt;
/**
* @var \DateTime
* @ORM\Column(name="updated_at", type="datetime")
*/
protected $updatedAt;
/**
* @ORM\OneToMany(targetEntity="Acme\AppBundle\Entity\Tag\Tagging", mappedBy="tag", fetch="EAGER")
**/
protected $tagging;
}
<?php
namespace Acme\AppBundle\Entity\Tag;
use FPN\TagBundle\Entity\Tagging as BaseTagging;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
/**
* @ORM\Table(name="acme_tagging",
* uniqueConstraints={@UniqueConstraint(name="tagging_idx", columns={"tag_id", "resource_type", "resource_id"})}
* )
* @ORM\Entity
*/
class Tagging extends BaseTagging
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Acme\AppBundle\Entity\Tag\Tag", inversedBy="tagging"))
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
**/
protected $tag;
/**
* @var string
* @ORM\Column(name="resource_type", type="string", length=50)
*/
protected $resourceType;
/**
* @var string
* @ORM\Column(name="resource_id", type="string", length=50)
*/
protected $resourceId;
/**
* @var \DateTime
* @ORM\Column(name="created_at", type="datetime")
*/
protected $createdAt;
/**
* @var \DateTime
* @ORM\Column(name="updated_at", type="datetime")
*/
protected $updatedAt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment