/** * Constructor * @param mixed $id * @param array $parameters */ function __construct($id, $parameters = null, $preload = false) { if ($parameters === null) { $parameters = array('fields' => self::getAllowedFields()); } parent::__construct($id, $parameters, $preload); }
function __get($property) { if ($property === 'friends') { $parameters = array('fields' => $this->getAllowedFields(array('friend' => true)), 'local_cache' => true); $this->__set(array($property => $this->getFriends($parameters))); return $this->{$property}; } if ($property === 'mutualfriends') { $this->__set(array($property => $this->getMutualfriendWith(Facebook::me()->id))); return $this->{$property}; } return parent::__get($property); }
/** * Constructor * @param mixed $id * @param array $parameters * @param bool $preload true: Fetch fields now. false: Fetch fields when needed. */ function __construct($id, $parameters = null, $preload = false) { if ($id === null || is_array($id)) { parent::__construct($id, $parameters, $preload); return; } if ($parameters === null) { // Fetch all allowed fields? $parameters = array('fields' => implode(',', $this->getAllowedFields(array('id' => $id)))); } parent::__construct($id, $parameters, $preload); }