Created
March 5, 2014 10:49
-
-
Save shahverd/9365035 to your computer and use it in GitHub Desktop.
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 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