Skip to content

Commit

Permalink
fix - isEmpty function
Browse files Browse the repository at this point in the history
  • Loading branch information
artgris committed Jun 23, 2019
1 parent 22c5d23 commit e92b089
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Entity/ArtgrisBlockTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,26 @@ public function setContentTranslatable($contentTranslatable): void
{
$this->contentTranslatable = $contentTranslatable;
}

public function isEmpty()
{

foreach (get_object_vars($this) as $var => $value) {
if (in_array($var, ['id', 'translatable', 'locale'])) {
continue;
}

if (!empty($value)) {
if (is_array($value)) {
if (!empty(array_filter($value))) {
return false;
}
} else {
return false;
}
}
}
return true;
}

}

0 comments on commit e92b089

Please sign in to comment.