Skip to content

Commit

Permalink
Merge pull request #117 from smallhadroncollider/fix-studly-case-enti…
Browse files Browse the repository at this point in the history
…ty-properties

fixed issue with entity property mutators studly case
  • Loading branch information
RemiCollin authored Aug 3, 2016
2 parents 8f5aa67 + c0f6eed commit 9105b9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ protected function hasSetMutator($key)
*/
protected function getMutatorMethod($key)
{
return ucfirst($key) . 'Attribute';
$key = ucwords(str_replace(['-', '_'], ' ', $key));
return str_replace(' ', '', $key) . "Attribute";
}

/**
Expand All @@ -101,7 +102,7 @@ public function toArray()
// First, call the trait method before filtering
// with Entity specific methods
$attributes = $this->attributesToArray($this->attributes);

foreach ($this->attributes as $key => $attribute) {
if (in_array($key, $this->hidden)) {
unset($attributes[$key]);
Expand Down

0 comments on commit 9105b9a

Please sign in to comment.