Skip to content

Instantly share code, notes, and snippets.

@adililhan
Created November 13, 2014 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adililhan/88959bd904ef0c231da3 to your computer and use it in GitHub Desktop.
Save adililhan/88959bd904ef0c231da3 to your computer and use it in GitHub Desktop.
Doctrine 2'de örnek @Version annotation'ının kullanımı
<?php
namespace Acme\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Post
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Acme\BlogBundle\Entity\PostRepository")
*/
class Post
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
protected $title;
/**
* @ORM\Column(type="text")
*/
protected $content;
/**
* @ORM\Column(type="integer")
* @ORM\Version
*/
protected $version;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set id
*
* @param integer $id
* @return Post
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Set title
*
* @param string $title
* @return Post
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set content
*
* @param string $content
* @return Post
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set version
*
* @param integer $version
* @return Post
*/
public function setVersion($version)
{
$this->version = $version;
return $this;
}
/**
* Get version
*
* @return integer
*/
public function getVersion()
{
return $this->version;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment