Created
July 26, 2011 18:55
-
-
Save kbond/1107578 to your computer and use it in GitHub Desktop.
DDC-1013
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Zenstruck\eBirdrBundle\Entity\Base; | |
use Zenstruck\eBirdrBundle\Entity\Page; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @author Kevin Bond <[email protected]> | |
* | |
* @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; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Zenstruck\eBirdrBundle\Entity\Base; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @author Kevin Bond <[email protected]> | |
* | |
* @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(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Zenstruck\eBirdrBundle\Entity; | |
use Zenstruck\eBirdrBundle\Entity\Base\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @author Kevin Bond <[email protected]> | |
* | |
* @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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Zenstruck\eBirdrBundle\Entity; | |
use Zenstruck\eBirdrBundle\Entity\Base\BaseClassification; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @author Kevin Bond <[email protected]> | |
* | |
* @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