How to check if field exists in an entity? In entity node, I want to check if 'abc' field exists or not. If exists, I will get its value by $value-&gt;get('abc').

But the content type where this field doesn't exists, gives error:

The website encountered an unexpected error. Please try again later.

How to check if field exists in an entity?
You can use the method hasField():

$entity-&gt;hasField('abc')