Skip to content

Commit

Permalink
Fixes an oddball bug
Browse files Browse the repository at this point in the history
  • Loading branch information
terwey committed Jun 16, 2014
1 parent b031906 commit 5ab6dc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
26 changes: 10 additions & 16 deletions newscoop/library/Newscoop/Entity/Snippet.php
Expand Up @@ -210,32 +210,26 @@ public function hasName()
/**
* Getter for fields
*
* @param string $includeBackend Includes the Backend Scope
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getFields($includeBackend = false)
public function getFields()
{
if (!$includeBackend) {
return $this->fields->filter(
function ($field) {
if ($field->getFieldScope() == 'frontend') {
return $field;
}
}
);
}

return $this->fields;
}

/**
* Getter for fields with the Backend scope
* Getter for fields without the Backend scope
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getFieldsWithBackend() {
return $this->getFields(true);
public function getFieldsWithoutBackend() {
return $this->fields->filter(
function ($field) {
if ($field->getFieldScope() == 'frontend') {
return $field;
}
}
);
}

/**
Expand Down
Expand Up @@ -20,7 +20,7 @@ Newscoop\Entity\Snippet:
serialized_name: fields
type: ArrayCollection<string, Newscoop\Entity\Snippet\SnippetField>
accessor:
getter: getFields
getter: getFieldsWithoutBackend
template:
expose: true
read_only: true
Expand Down

0 comments on commit 5ab6dc4

Please sign in to comment.