Skip to content

Instantly share code, notes, and snippets.

@shahverd
Created March 5, 2014 10:49
Show Gist options
  • Save shahverd/9365035 to your computer and use it in GitHub Desktop.
Save shahverd/9365035 to your computer and use it in GitHub Desktop.
<?php
namespace SocialNetwork\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* User
*
* @ORM\Table(name="user", indexes={@ORM\Index(name="IDX_8D93D649D60322AC", columns={"domain"})})
* @ORM\Entity
*/
class User extends ParentEntity
{
public function __call($name, $value) {
/* $trace=debug_backtrace();
$caller=array_shift($trace);
echo "Called by {$caller['function']}";
if (isset($caller['class']))
echo " in {$caller['class']}";
*/
$type = substr($name, 0, 3);
$variable = lcfirst(substr($name, 3));
if($type == 'get'){
return $this->$variable;
}elseif($type == 'set'){
$this->$variable = $value[0];
return $this;
}else{
return call_user_func_array(array($this, $name), $arguments);
}
}
public function setEmail($email)
{
$trace=debug_backtrace();
$caller=array_shift($trace);
echo "Called by {$caller['function']}";
if (isset($caller['class']))
echo " in {$caller['class']}";
$this->email = $email;
return $this;
}
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment