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.

  • Have you override this class in custom module ? – user55548 Dec 15 '18 at 6:00
  • Thanks but i have disabled all custom modules so it must have something to do with Magento? – Mehdi Rafiai Dec 15 '18 at 9:58
12
+50

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

grep -rnw '/path/to/magento2-root' -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

  • Finally, this solved the problem and i am now able to run setup:di:compile. Thank you! – Mehdi Rafiai Dec 18 '18 at 15:19
  • How you have fixed? – Magecode Mar 27 at 6:04
  • perfect answer!!! +1 :) made my day – SagarPPanchal Aug 6 at 6:41
1

Dirty Hack

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

;)

1

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

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.

  • 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 9:14
0

Clear your generated folder and run the compile command.

rm -rf generated/*

Then run the compile command

bin/magento setup:di:compile
  • Thank you, done that plenty of times alongside var/* cache/* etc. No difference. – Mehdi Rafiai Dec 18 '18 at 10:37
  • Can you check if this class really exists: Magento\Email\Model\Source\Variables by going to that path. – Sourabh Kumar Sharma Dec 18 '18 at 10:38
  • I assume the path is generated/code/Magento/Email/Model - if so, there's no Source directory in there. – Mehdi Rafiai Dec 18 '18 at 10:48
  • In magento2.2 the class is there, but it looks like this class was removed from magento2.3. – gemig_hol Dec 18 '18 at 11:07
  • 1
    Let us continue this discussion in chat. – gemig_hol Dec 18 '18 at 14:28
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

  • 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

Class Bss\HtmlSiteMap\Model\Filter

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

replace

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.