6

After I upgraded to Magento 2.3, running the command setup:di:compile, I get this error:

Area configuration aggregation... 5/7 [====================>-------]  71% 58 
secs 276.0 MiB
In ClassReader.php line 35:

  Class Magento\Email\Model\Source\Variables does not exist

In ClassReader.php line 29:

   Class Magento\Email\Model\Source\Variables does not exist

setup:di:compile

I've checked the database setup_module to ensure no mismatch or missing scheme/data versions but all are ok.

Aasim Goriya
  • 5,444
  • 2
  • 28
  • 53
Mehdi Rafiai
  • 421
  • 2
  • 7
  • 22

7 Answers7

24

Search for the missing class in your magento2 code, you can do via linux cli:

find /path/to/magento2-root -type f -iname '*.php' -print0 | xargs -0 grep -nw -e 'Magento\\Email\\Model\\Source\\Variables'

and comment any line calling this class (that was removed from magento2.3)

UPDATE

You can also change this class in Magento 2.3 for Magento\Variable\Model\Source\Variables

Luka
  • 113
  • 4
gemig_hol
  • 871
  • 1
  • 7
  • 13
2

I just replaced the class Magento\Email\Model\Source\Variables with Magento\Variable\Model\Source\Variables.

hanego
  • 121
  • 4
2

Class Bss\HtmlSiteMap\Model\Filter

public function __construct(
    ...  
    \Magento\Email\Model\Source\Variables $configVariables,
    ...
)

replace

public function __construct(
    ...  
    \Magento\Variable\Model\Source\Variables $configVariables,
    ...
)
1

Dirty Hack

Rename registration.php file of module which is causing problem for compilation.

;)

anonymous
  • 3,722
  • 3
  • 25
  • 67
0

Have you used any SMTP extension? If yes then please remove that and then try to run the command :

php bin/magento setup:di:compile

If your issue is resolved then install 2.3 compatible SMTP extension.

Arshad M
  • 866
  • 1
  • 9
  • 13
Sneha Panchal
  • 886
  • 14
  • 30
  • I've not used any extensions like this, for further testing i removed env.php and config.php so i can reinstall Magento 2.3, i deselected all modules apart from what Magento needs and i still get the same error. – Mehdi Rafiai Dec 18 '18 at 09:14
0

If you use any custom extensions, check the compatibility with Magento 2.3

All extensions that are not compatible must be removed, for example, Mageplaza smtp was not compatible and Mageworx CEO tool is was also not compatible.

After then run below command: php bin/magent setup:di:compile

Prakash Patel
  • 1,674
  • 16
  • 19
  • Understood, but as per my comments above i have disabled all modules and only left on what Magento needs. Stripped it down and i still get the same error. – Mehdi Rafiai Dec 18 '18 at 10:12
0

Clear your generated folder and run the compile command.

rm -rf generated/*

Then run the compile command

bin/magento setup:di:compile