Nov 14, 2019 in Drupal 8, Snippets

We all well know the functions to check if a node is published or not, but what about a custom entity?

I have a custom entity called 'group'. I had to do the following:

if ($group->status->getString() == 1) {
 // the group is published
}