Skip to content

@kbond /BaseClassification.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
DDC-1013
<?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;
}
}
<?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();
}
}
<?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;
}
<?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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.