public
Created

DDC-1013

  • Download Gist
BaseClassification.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<?php
 
namespace Zenstruck\eBirdrBundle\Entity\Base;
 
use Zenstruck\eBirdrBundle\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
 
/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @ORM\MappedSuperClass
*/
class BaseClassification extends Page
{
/**
* @ORM\Column(type="string", nullable=true, name="latin_name")
*/
protected $latinName;
 
public function getLatinName()
{
return $this->latinName;
}
 
public function setLatinName($latinName)
{
$this->latinName = $latinName;
}
 
 
}
Entity.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
<?php
 
namespace Zenstruck\eBirdrBundle\Entity\Base;
 
use Doctrine\ORM\Mapping as ORM;
 
/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @ORM\MappedSuperClass
* @ORM\HasLifecycleCallbacks
*/
class Entity
{
 
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
 
/**
* @ORM\Column(type="string")
*/
protected $title;
 
/**
* @var datetime $updatedAt
*
* @ORM\Column(type="datetime", name="updated_at")
*/
protected $updatedAt;
 
/**
* @var datetime $createdAt
*
* @ORM\Column(type="datetime", name="created_at")
*/
protected $createdAt;
 
public function __construct()
{
$this->updatedAt = $this->createdAt = new \DateTime();
}
 
public function getId()
{
return $this->id;
}
 
public function setId($id)
{
$this->id = $id;
}
 
public function getTitle()
{
return $this->title;
}
 
public function setTitle($title)
{
$this->title = $title;
}
 
public function getUpdatedAt()
{
return $this->updatedAt;
}
 
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
}
 
public function getCreatedAt()
{
return $this->createdAt;
}
 
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
}
 
/**
* @ORM\PreUpdate
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
 
}
Page.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?php
 
namespace Zenstruck\eBirdrBundle\Entity;
 
use Zenstruck\eBirdrBundle\Entity\Base\Entity;
use Doctrine\ORM\Mapping as ORM;
 
/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @ORM\Entity
* @ORM\Table(
* name="page",
* uniqueConstraints={@ORM\UniqueConstraint(name="path_unique",columns={"path"})}
* )
*/
class Page extends Entity
{
 
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $body;
 
/**
* @ORM\Column(type="string")
*/
protected $path;
}
Species.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<?php
 
namespace Zenstruck\eBirdrBundle\Entity;
 
use Zenstruck\eBirdrBundle\Entity\Base\BaseClassification;
use Doctrine\ORM\Mapping as ORM;
 
/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @ORM\Entity
* @ORM\Table(
* name="species",
* uniqueConstraints={@ORM\UniqueConstraint(name="path_unique",columns={"path"})}
* )
*/
class Species extends BaseClassification
{
/**
* @ORM\Column(type="string", nullable=true, name="alternate_names")
*/
protected $alternateNames;
 
/**
* @ORM\ManyToOne(targetEntity="Classification", inversedBy="species")
* @ORM\JoinColumn(name="genus_id", referencedColumnName="id")
*/
protected $genus;
 
/**
* @ORM\OneToMany(targetEntity="Image", mappedBy="species")
*/
protected $images;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.