Skip to content

Instantly share code, notes, and snippets.

@ikwattro
Created July 23, 2015 23:14
Show Gist options
  • Save ikwattro/f1c1adfae0dcf2155400 to your computer and use it in GitHub Desktop.
Save ikwattro/f1c1adfae0dcf2155400 to your computer and use it in GitHub Desktop.
OGM Thoughts
<?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