/**
  * Implements the magic __sleep() method.
  */
 public function __sleep()
 {
     // Only serialize necessary properties, excluding those that can be
     // recalculated.
     unset($this->baseFieldDefinition);
     return parent::__sleep();
 }