123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <?php
- /*
- * This file is part of Packagist.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- * Nils Adermann <naderman@naderman.de>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Packagist\WebBundle\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Entity(repositoryClass="Packagist\WebBundle\Entity\AuthorRepository")
- * @ORM\Table(name="author")
- * @author Jordi Boggiano <j.boggiano@seld.be>
- */
- class Author
- {
- /**
- * @ORM\Id
- * @ORM\Column(type="integer")
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * Unique package name
- *
- * @ORM\Column(type="text", nullable=true)
- */
- private $name;
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- private $email;
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- private $homepage;
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- private $role;
- /**
- * @ORM\ManyToMany(targetEntity="Packagist\WebBundle\Entity\Version", mappedBy="authors")
- */
- private $versions;
- /**
- * @ORM\ManyToOne(targetEntity="Packagist\WebBundle\Entity\User")
- */
- private $owner;
- /**
- * @ORM\Column(type="datetime")
- */
- private $createdAt;
- /**
- * @ORM\Column(type="datetime", nullable=true)
- */
- private $updatedAt;
- public function __construct()
- {
- $this->versions = new ArrayCollection();
- $this->createdAt = new \DateTime;
- }
- public function toArray()
- {
- $data = array();
- if ($this->getName()) {
- $data['name'] = $this->getName();
- }
- if ($this->getEmail()) {
- $data['email'] = $this->getEmail();
- }
- if ($this->getHomepage()) {
- $data['homepage'] = $this->getHomepage();
- }
- if ($this->getRole()) {
- $data['role'] = $this->getRole();
- }
- return $data;
- }
- /**
- * Get id
- *
- * @return string $id
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set name
- *
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
- /**
- * Get name
- *
- * @return string $name
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set createdAt
- *
- * @param \DateTime $createdAt
- */
- public function setCreatedAt($createdAt)
- {
- $this->createdAt = $createdAt;
- }
- /**
- * Get createdAt
- *
- * @return \DateTime $createdAt
- */
- public function getCreatedAt()
- {
- return $this->createdAt;
- }
- /**
- * Add versions
- *
- * @param Version $version
- */
- public function addVersion(Version $version)
- {
- $this->versions[] = $version;
- }
- /**
- * Get versions
- *
- * @return Version[]
- */
- public function getVersions()
- {
- return $this->versions;
- }
- /**
- * Set updatedAt
- *
- * @param \DateTime $updatedAt
- */
- public function setUpdatedAt(\DateTime $updatedAt)
- {
- $this->updatedAt = $updatedAt;
- }
- /**
- * Get updatedAt
- *
- * @return \DateTime $updatedAt
- */
- public function getUpdatedAt()
- {
- return $this->updatedAt;
- }
- /**
- * Set email
- *
- * @param string $email
- */
- public function setEmail($email)
- {
- $this->email = $email;
- }
- /**
- * Get email
- *
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * Set homepage
- *
- * @param string $homepage
- */
- public function setHomepage($homepage)
- {
- $this->homepage = $homepage;
- }
- /**
- * Get homepage
- *
- * @return string
- */
- public function getHomepage()
- {
- return $this->homepage;
- }
- /**
- * Set role
- *
- * @param string $role
- */
- public function setRole($role)
- {
- $this->role = $role;
- }
- /**
- * Get role
- *
- * @return string $role
- */
- public function getRole()
- {
- return $this->role;
- }
- /**
- * Set owner
- *
- * @param User $owner
- */
- public function setOwner(User $owner)
- {
- $this->owner = $owner;
- }
- /**
- * Get owner
- *
- * @return User
- */
- public function getOwner()
- {
- return $this->owner;
- }
- }
|