Created
July 23, 2015 23:14
-
-
Save ikwattro/f1c1adfae0dcf2155400 to your computer and use it in GitHub Desktop.
OGM Thoughts
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 Play\Entities; | |
use Fathom\Runtime\Annotation as OGM; | |
/** | |
* @OGM\Entity(labels="User") | |
*/ | |
class User | |
{ | |
/** | |
* @OGM\Id | |
*/ | |
protected $id; | |
/** | |
* @OGM\Property(type="string") | |
*/ | |
protected $firstName; | |
/** | |
* @OGM\Property(name="last_name") | |
*/ | |
protected $lastName; | |
/** | |
* @OGM\DynamicLabel(name="ActiveUser") | |
*/ | |
protected $isActive; | |
/** | |
* @OGM\ManyToMany(type="FOLLOWS", direction="OUTGOING", otherNode="Play\Entities\User") | |
*/ | |
protected $followers; | |
/** | |
* @return mixed | |
*/ | |
public function getFirstName() | |
{ | |
return $this->firstName; | |
} | |
/** | |
* @param mixed $firstName | |
*/ | |
public function setFirstName($firstName) | |
{ | |
$this->firstName = $firstName; | |
} | |
/** | |
* @return mixed | |
*/ | |
public function getLastName() | |
{ | |
return $this->lastName; | |
} | |
/** | |
* @param mixed $lastName | |
*/ | |
public function setLastName($lastName) | |
{ | |
$this->lastName = $lastName; | |
} | |
/** | |
* @return \Play\Entities\User[] | |
*/ | |
public function getFollowers() | |
{ | |
return $this->followers; | |
} | |
/** | |
* @param array $followers | |
*/ | |
public function setFollowers(array $followers) | |
{ | |
$this->followers = $followers; | |
} | |
/** | |
* @param \Play\Entities\User $follower | |
*/ | |
public function addFollower(User $follower) | |
{ | |
$this->followers[] = $follower; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment