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
}

 

 

 

Saved you some valuable time?

Received 100 so far from 4 kind contributors.