Skip to content

Instantly share code, notes, and snippets.

@rileyrg
Created June 11, 2017 13:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rileyrg/60981611fd902c7e63b1acc20c6b034a to your computer and use it in GitHub Desktop.
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\GenusRepository")
* @ORM\Table(name="genus")
*/
class Genus
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string")
*/
private $name;
/**
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\SubFamily")
* @ORM\JoinColumn(nullable=false)
*/
private $subFamily;
/**
* @Assert\NotBlank()
* @Assert\Range(min=0, minMessage="Negative species! Come on...")
* @ORM\Column(type="integer")
*/
private $speciesCount;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $funFact;
/**
* @ORM\Column(type="boolean")
*/
private $isPublished = true;
/**
* @return mixed
*/
public function getisPublished()
{
return $this->isPublished;
}
/**
* @Assert\NotBlank()
* @ORM\Column(type="date")
*/
private $firstDiscoveredAt;
/**
* @ORM\OneToMany(targetEntity="GenusNote", mappedBy="genus")
* @ORM\OrderBy({"createdAt" = "DESC"})
*/
private $notes;
public function __construct()
{
$this->notes = new ArrayCollection();
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
/**
* @return SubFamily
*/
public function getSubFamily()
{
return $this->subFamily;
}
public function setSubFamily(SubFamily $subFamily = null)
{
$this->subFamily = $subFamily;
}
public function getSpeciesCount()
{
return $this->speciesCount;
}
public function setSpeciesCount($speciesCount)
{
$this->speciesCount = $speciesCount;
}
public function getFunFact()
{
return '**TEST** '.$this->funFact;
}
public function setFunFact($funFact)
{
$this->funFact = $funFact;
}
public function getUpdatedAt()
{
return new \DateTime('-'.rand(0, 100).' days');
}
public function setIsPublished($isPublished)
{
$this->isPublished = $isPublished;
}
/**
* @return ArrayCollection|GenusNote[]
*/
public function getNotes()
{
return $this->notes;
}
public function getFirstDiscoveredAt()
{
return $this->firstDiscoveredAt;
}
public function setFirstDiscoveredAt(\DateTime $firstDiscoveredAt = null)
{
$this->firstDiscoveredAt = $firstDiscoveredAt;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment