Skip to content

Commit

Permalink
Added organ type.
Browse files Browse the repository at this point in the history
Fixes #7
  • Loading branch information
kokx committed Mar 17, 2014
1 parent b8c28aa commit 99fd689
Showing 1 changed file with 51 additions and 2 deletions.
53 changes: 51 additions & 2 deletions module/Database/src/Database/Model/SubDecision/Foundation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,44 @@
*/
class Foundation extends SubDecision
{

const ORGAN_TYPE_COMMITTEE = 'committee';
const ORGAN_TYPE_FRATERNITY = 'fraternity';

/**
* Abbreviation (only for when organs are created)
*
* @ORM\Column(type="string", nullable=true)
* @ORM\Column(type="string")
*/
protected $abbr;

/**
* Name (only for when organs are created)
*
* @ORM\Column(type="string", nullable=true)
* @ORM\Column(type="string")
*/
protected $name;

/**
* Type of the organ.
*
* @ORM\Column(type="string")
*/
protected $organType;


/**
* Get available organ types.
*
* @return array
*/
public function getOrganTypes()
{
return array(
self::ORGAN_TYPE_COMMITTEE,
self::ORGAN_TYPE_FRATERNITY
);
}

/**
* Get the abbreviation.
Expand Down Expand Up @@ -68,6 +92,31 @@ public function setName($name)
$this->name = $name;
}

/**
* Get the type.
*
* @return string
*/
public function getOrganType()
{
return $this->organType;
}

/**
* Set the type.
*
* @param string $organType
*
* @throws \InvalidArgumentException if the type is wrong
*/
public function setOrganType($organType)
{
if (!in_array($organType, self::getOrganTypes())) {
throw new \InvalidArgumentException("Given type does not exist.");
}
$this->organType = $organType;
}

/**
* Get the content.
*
Expand Down

0 comments on commit 99fd689

Please sign in to comment.