Skip to content

Commit

Permalink
Merge pull request #3 from adamgoose/develop
Browse files Browse the repository at this point in the history
Prevent errors on dynamic attribute gets.
  • Loading branch information
adamgoose committed Nov 15, 2013
2 parents 2fcf568 + 63af584 commit 7718009
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Adamgoose/PrismicIo/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ public static function __callStatic($method, $parameters)
*/
public function __get($key)
{
if($this->document instanceof Document)
return $this->document->get($this->document->getType().'.'.$key)->asText();
if($this->document instanceof Document) {
if(array_key_exists($this->document->getType.".".$key, $this->document->getFragments()))
return $this->document->get($this->document->getType().'.'.$key)->asText();
else
return '';
}
else
return $this->{$key};
}
Expand Down

0 comments on commit 7718009

Please sign in to comment.