Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Last active October 9, 2015 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaEstes/0a4596afc5c8f8594207 to your computer and use it in GitHub Desktop.
Save JoshuaEstes/0a4596afc5c8f8594207 to your computer and use it in GitHub Desktop.
<?php
namespace AppBundle\Entity;
use Symfony\Component\Security\Core\User\UserInterface;
class UserSetting
{
/**
* @var UserInterface
* @ORM\ManyToOne(targetEntity="User", inversedBy="settings", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $user;
/**
* @var string
*/
protected $key;
/**
* @var string
*/
protected $value;
/**
* Just for easying the creation of new UserSetting objects
*
* @param string $key
* @param string $value
*/
public function __construct($key = null, $value = null)
{
$this->key = $key;
$this->value = $value;
}
/**
* Magic Method
*/
public function __toString()
{
return (string) $this->value;
}
/**
* @return UserInterface
*/
public function getUser()
{
$this->user;
}
/**
* @param UserInterface $user
* @return self
*/
public function setUser(UserInterface $user)
{
$this->user = $user;
return $this;
}
public function getKey()
{
return $this->key;
}
public function setKey($key)
{
$this->key = $key;
return $tihs;
}
public function getValue()
{
return $this->value;
}
public function setValue($value)
{
$this->value = $value;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment