2

I've made a new extension for my company, while developing everything seems to work properly. But when I've tried to install my extension I encountered some problems. At the beginning I've tried to install it by Web Setup Wizard, in version 2.1.2 I received some errors, log below:

[2017-01-11 13:40:11 CET] Job "maintenance_mode {"enable":true}" has been started 
[2017-01-11 13:40:11 CET] Magento maintenance mode is
enabled. 
[2017-01-11 13:40:11 CET] Job "maintenance_mode {"enable":true}" has successfully completed 

[2017-01-11 12:41:03 UTC] Job "setup:cache:disable []" has started Changed cache status: 
config: 1 -> 0 
layout: 1 -> 0 
block_html: 1 -> 0 
collections: 1 -> 0
reflection: 1 -> 0 
db_ddl: 1 -> 0 
eav: 1 -> 0 
customer_notification: 1 -> 0 
full_page: 1 -> 0 
config_integration: 1 -> 0 
config_integration_api: 1 -> 0 
translate: 1 -> 0 
config_webservice: 1 -> 0

[2017-01-11 12:41:03 UTC] Job "setup:cache:disable []" has been successfully completed 
[2017-01-11 12:41:03 UTC] Job "setup:module:disable {"components":[{"name":"Salesmanago_Integration"}]}" has started The following modules have been disabled:
- Salesmanago_Integration

Cache cleared successfully. Generated classes cleared successfully.
Please run the 'setup:di:compile' command to generate classes. Info:
Some modules might require static view files to be cleared. To do
this, run 'module:disable' with the --clear-static-content option to
clear them.

[2017-01-11 12:41:04 UTC] Cleaning generated files... 
[2017-01-11 12:41:05 UTC] Complete! [2017-01-11 12:41:05 UTC] Clearing cache...
[2017-01-11 12:41:05 UTC] Complete! [2017-01-11 12:41:05 UTC] Job "setup:module:disable {"components":[{"name":"Salesmanago_Integration"}]}" has been successfully completed
[2017-01-11 12:41:05 UTC] Job "setup:cache:enable ["config layout block_html collections reflection db_ddl eav customer_notification full_page config_integration config_integration_api translate config_webservice"]" has started 
Changed cache status: 
config: 0 -> 1 
layout: 0 -> 1 
block_html: 0 -> 1
collections: 0 -> 1 
reflection: 0 -> 1 
db_ddl: 0 -> 1 
eav: 0 -> 1
customer_notification: 0 -> 1 
full_page: 0 -> 1 
config_integration: 0 -> 1 
config_integration_api: 0 -> 1 
translate: 0 -> 1 
config_webservice: 0 -> 1

[2017-01-11 12:41:05 UTC] An error occurred while executing job
"setup:cache:enable ["config layout block_html collections reflection
db_ddl eav customer_notification full_page config_integration
config_integration_api translate config_webservice"]": Could not
complete setup:cache:enable ["config layout block_html collections
reflection db_ddl eav customer_notification full_page
config_integration config_integration_api translate
config_webservice"] successfully: Warning: ltrim() expects parameter 1
to be string, object given in
/var/www/html/magento-212opt/vendor/magento/framework/Code/Generator/EntityAbstract.php
on line 152 
[2017-01-11 13:42:03 CET] There was an error in previous
Update attempt.

I've read that it was connected with some errors in Magento 2, is this true ?

Later I was looking for alternative installation types.

First option: Copy extension to app/code and add line to etc/config.php

'Salesmanago_Integration' => 1,

And after page reload it was ok on my local machine.

Second Option: Paste extension to app/code and than run:

 php bin/magento setup:upgrade 

 php bin/magentosetup:static-content:deploy 

 chmod -R 777 var pub/static

This one also works on my local machine.

Not the questions, which option is the best? Why Web Wizard doesn't work ? There is a problem with plugin ?

  • best way is to make it a composer package and install it with composer – Claudiu Creanga Feb 9 '17 at 13:40
  • But I am looking for user friendly installation. We need to give this plugin to our clients so it should be simple... I guess that not every clients have his IT or knows how to use composer or if they have it. How about options from above ? – P. Grzanka Feb 9 '17 at 13:53
  • Ideally you'll have both. as composer because it is bullet proof and very fast. but if they don't know how to open the terminal then you should offer them as a zip file too. We receive a lot of extensions as zip files. all you need is to drag and drop the folder in app folder. no need to edit etc/config.php. This will be done automatically by setup:upgrade. but still this needs access to terminal... hmm.. on second thought I don't think a magento2 website can be maintained without doing stuff in the terminal. – Claudiu Creanga Feb 9 '17 at 14:55
  • If Magento2 can't be maintained without using terminal, so our clients with this platform should have some IT support to install things. I think zip package will be the best for us. – P. Grzanka Feb 10 '17 at 8:52
  • Summarizing your reply, adding line to config.php is equivalent to setup:upgrade, so maybe we will stay in terminal and use second option but I need to ask... Is it safe? Setup::Upgrade will check every modules and update if there is a need, second command (static-content:deploy) will refresh cache and static content and last comma will change permissions to directories with cache. It seems to be simple but is it safe ? – P. Grzanka Feb 10 '17 at 8:58
0
Warning: ltrim() expects parameter 1
to be string, object given in
/var/www/html/magento-212opt/vendor/magento/framework/Code/Generator/EntityAbstract.php
on line 152

This suggests you are passing an object instead instead of the expecting class name.

/**
 * Get fully qualified class name
 *
 * @param string $className
 * @return string
 */
protected function _getFullyQualifiedClassName($className)
{
    $className = ltrim($className, '\\');
    return $className ? '\\' . $className : '';
}

This happen to me when I switched from developer mode to production mode.

I fixed it by deleting the content of var/di folder.

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.