How to check if entity's property has a value How can I check if entity's property has a value? I don't think this is the "drupal way" to check it like this

$page_optimization-&gt;title-&gt;value() !== ''


Is there any method, something like $page_optimization->title->hasValue() etc.
If you look at the entity module, specifically the EntityMetadataWrapper class, there is no method of checking whether or not something has a value.  If a value returns empty you are essentially checking whether or not the value exists by getting an empty value.  

For example a single value uses the EntityValueWrapper and only has one method and that is to return the value.  The EntityMetadataWrapper class has few public methods and none that returns whether or not a value is set.  If you wanted to extend one of the classes you could probably build your own method.

/**
 * Wraps a single value.
 */
class EntityValueWrapper extends EntityMetadataWrapper {

  /**
   * Overrides EntityMetadataWrapper#value().
   * Sanitizes or decode textual data if necessary.
   */
  public function value(array $options = array()) {
    $data = parent::value();
    if ($this-&gt;type == 'text' &amp;&amp; isset($data)) {
      $info = $this-&gt;info + array('sanitized' =&gt; FALSE, 'sanitize' =&gt; 'check_plain');
      $options += array('sanitize' =&gt; FALSE, 'decode' =&gt; FALSE);
      if ($options['sanitize'] &amp;&amp; !$info['sanitized']) {
        return call_user_func($info['sanitize'], $data);
      }
      elseif ($options['decode'] &amp;&amp; $info['sanitized']) {
        return decode_entities(strip_tags($data));
      }
    }
    return $data;
  }
}