Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300130

EntityForm's use of magic setter/getter breaks any subclasses that don't declare a property

$
0
0

EntityForm has a magic setter and getter to take care of triggering a deprecation error, eg:

  public function __get($name) {
    // Removing core's usage of ::setEntityManager means that this deprecated
    // service wont be set. We provide it here for backwards compatibility.
    if ($name === 'entityManager') {
      @trigger_error('EntityForm::entityManager is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use EntityForm::entityTypeManager instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
      return $this->privateEntityManager ?: \Drupal::entityManager();
    }
  }

However, this does nothing when $name is not entityManager. So any form class that does $this->foo = 'bar' without having declared $foo as a class property will suddenly find that setting the value has no effect.

Credit to @aalin to figuring this one at #3093329: $moduleEntityData error in ComponentSectionForm.php.


Viewing all articles
Browse latest Browse all 300130

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>