Created
January 8, 2020 13:46
-
-
Save rpayanm/ca97458d2141b5dc27fb542f549ffbad to your computer and use it in GitHub Desktop.
Revisions
-
rpayanm created this gist
Jan 8, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ ``` private $service; public function __construct($service) { $this->service = $service; } Call to a member function ...() on null in Drupal\...\Form\...->buildForm() ``` The problem is is your use of private. Don't use it, use protected. Drupal has a special logic to prevent services from being serialized but it doesn't work properly on private properties, as they are invisible to the trait that is used for that.