Open FirstSanny opened 5 years ago
I can replicate the same error on the latest dev branch of console and console-core
I'm getting the same error during custom content entity generation (drupal generate:entity:content
).
I'm also getting the same error during custom content entity generation (drupal generate:entity:content).
Having the same problem with gprr. The class is there but the yml file is not.
Getting the same errors when running drupal generate:command
So, the problem here that class \Drupal\Core\Extension\Extension doesn't implement Serializable interface anymore
I'm looking for a solution
PR https://github.com/hechoendrupal/drupal-console/pull/4013/files
It is a quick solution for now.
My proposal: I think we should create a proxy class and not directly extend \Drupal\Core\Extension\Extension This class will handle all extensions paths and will contain inside original extension object, but it will touch many modules.
@jmolivas Any ideas?
The PR proposed by @LOBsTerr seems to fix the issue, at least for the drupal generate:entity:content command.
For a temporary workaround until this is committed you can run drush entup
or drupal upe
after the failure to install the table(s) in the DB.
I can't reproduce the issue:
Drupal version 8.6.15 Console version 1.8.0 Console Launcher version 1.8.0
guido@pavilion:~/Desktop/Guido/www/drupal8-local/web/sites $ drupal config:export:content:type page
Enter the module name [webform_access]:
>
Export content type in module as an optional configuration (yes/no) [yes]:
> no
Content Type to be exported without uuid key. (yes/no) [yes]:
>
Content type to be exported without the default site hash key. (yes/no) [yes]:
>
// config:export:entity
commands.config.export.entity.questions.optional-config (yes/no) [yes]:
>
commands.config.export.entity.messages.content-type-exported
- modules/contrib/webform/modules/webform_access/config/optional/node.type.page.yml
- modules/contrib/webform/modules/webform_access/config/optional/field.field.node.page.body.yml
- modules/contrib/webform/modules/webform_access/config/optional/field.storage.node.body.yml
- modules/contrib/webform/modules/webform_access/config/optional/core.entity_form_display.node.page.default.yml
- modules/contrib/webform/modules/webform_access/config/optional/core.entity_view_display.node.page.default.yml
- modules/contrib/webform/modules/webform_access/config/optional/core.entity_view_display.node.page.teaser.yml
- modules/contrib/webform/modules/webform_access/config/optional/core.entity_view_mode.node.teaser.yml
That's interessting. I can still reproduce it with exactly the version numbers you are reffering to. But that means, that the reason could be one of my installed modules?
[ec2-user@ip-123-45-67-890 current]$ drupal config:export:content:type page
Enter the module name [address]:
>
Export content type in module as an optional configuration (yes/no) [yes]:
> no
commands.config.export.content.type.questions.remove-uuid (yes/no) [yes]:
>
commands.config.export.content.type.questions.remove-config-hash (yes/no) [yes]:
>
Exporting content type
- modules/contrib/address/config/install/node.type.page.yml
- modules/contrib/address/config/install/field.field.node.page.body.yml
- modules/contrib/address/config/install/field.storage.node.body.yml
- modules/contrib/address/config/install/core.entity_form_display.node.page.default.yml
- modules/contrib/address/config/install/core.entity_view_display.node.page.default.yml
- modules/contrib/address/config/install/core.entity_view_display.node.page.teaser.yml
- modules/contrib/address/config/install/core.entity_view_mode.node.teaser.yml
[ERROR] <em class="placeholder">Warning</em>: call_user_func_array() expects parameter 1 to be a valid callback,
class 'SplFileInfo' does not have a method 'serialize' in <em
class="placeholder">Drupal\Core\Extension\Extension->__call()</em> (line <em class="placeholder">160</em>
of <em class="placeholder">core/lib/Drupal/Core/Extension/Extension.php</em>). <pre
class="backtrace">Drupal\Core\Extension\Extension->__call('serialize', Array) (Line: 314)
Drupal\Console\Extension\Manager->createExtension(Object) (Line: 251)
Drupal\Console\Extension\Manager->getModule('address') (Line: 86)
Drupal\Console\Command\Config\ExportContentTypeCommand->exportConfigToModule('address',
'Exporting content type') (Line: 183)
Drupal\Console\Command\Config\ExportContentTypeCommand->execute(Object, Object) (Line: 255)
Symfony\Component\Console\Command\Command->run(Object, Object) (Line: 978)
Symfony\Component\Console\Application->doRunCommand(Object, Object, Object) (Line: 255)
Symfony\Component\Console\Application->doRun(Object, Object) (Line: 185)
Drupal\Console\Core\Application->doRun(Object, Object) (Line: 64)
Drupal\Console\Application->doRun(Object, Object) (Line: 148)
Symfony\Component\Console\Application->run() (Line: 89)
require('/var/app/current/vendor/drupal/console/bin/drupal.php') (Line: 4)
</pre>
[ERROR] <em class="placeholder">Warning</em>: call_user_func_array() expects parameter 1 to be a valid callback,
class 'SplFileInfo' does not have a method 'unserialize' in <em
class="placeholder">Drupal\Core\Extension\Extension->__call()</em> (line <em class="placeholder">160</em>
of <em class="placeholder">core/lib/Drupal/Core/Extension/Extension.php</em>). <pre
class="backtrace">Drupal\Core\Extension\Extension->__call('unserialize', Array) (Line: 314)
Drupal\Console\Extension\Manager->createExtension(Object) (Line: 251)
Drupal\Console\Extension\Manager->getModule('address') (Line: 86)
Drupal\Console\Command\Config\ExportContentTypeCommand->exportConfigToModule('address',
'Exporting content type') (Line: 183)
Drupal\Console\Command\Config\ExportContentTypeCommand->execute(Object, Object) (Line: 255)
Symfony\Component\Console\Command\Command->run(Object, Object) (Line: 978)
Symfony\Component\Console\Application->doRunCommand(Object, Object, Object) (Line: 255)
Symfony\Component\Console\Application->doRun(Object, Object) (Line: 185)
Drupal\Console\Core\Application->doRun(Object, Object) (Line: 64)
Drupal\Console\Application->doRun(Object, Object) (Line: 148)
Symfony\Component\Console\Application->run() (Line: 89)
require('/var/app/current/vendor/drupal/console/bin/drupal.php') (Line: 4)
</pre>
@FirstSanny The fix proposed by me above is not merged to dev version. The problem is not in the specific module. It is related to the update of the core, some code was changed and now we need to adapt DC. Anyway, the command is still generating correctly the content types. If you check the log message above the warnings.
@LOBsTerr I can't reproduce the issue to review the PR
Drupal version 8.6.11 / 8.7.1 Console version 1.8.0 Console Launcher version 1.8.0
I run the following commands to check and everything was ok
drupal drupal config:export:content:type page
Enter the module name [demo]:
>
Export content type in module as an optional configuration (yes/no) [yes]:
> no
commands.config.export.content.type.questions.remove-uuid (yes/no) [yes]:
>
commands.config.export.content.type.questions.remove-config-hash (yes/no) [yes]:
>
Exporting content type
- modules/custom/demo/config/install/node.type.page.yml
- modules/custom/demo/config/install/field.field.node.page.body.yml
- modules/custom/demo/config/install/field.storage.node.body.yml
- modules/custom/demo/config/install/core.entity_form_display.node.page.default.yml
- modules/custom/demo/config/install/core.entity_view_display.node.page.default.yml
- modules/custom/demo/config/install/core.entity_view_display.node.page.teaser.yml
- modules/custom/demo/config/install/core.entity_view_mode.node.teaser.yml
drupal generate:entity:content
// Welcome to the Drupal Content Entity generator
Enter the module name [demo]:
>
Enter the class of your new content entity [DefaultEntity]:
>
Enter the machine name of your new content entity [default_entity]:
>
Enter the label of your new content entity [Default entity]:
>
Enter the base-path for the content entity routes [/admin/structure]:
>
Do you want this (content) entity to have bundles? (yes/no) [no]:
>
Is your entity translatable? (yes/no) [yes]:
> no
Is your entity revisionable? (yes/no) [yes]:
> no
Generated or updated files
Generation path: /Users/hjuarez/drupal/web
1 - modules/custom/demo/demo.permissions.yml
2 - modules/custom/demo/demo.links.menu.yml
3 - modules/custom/demo/demo.links.task.yml
4 - modules/custom/demo/demo.links.action.yml
5 - modules/custom/demo/src/DefaultEntityAccessControlHandler.php
6 - modules/custom/demo/src/Entity/DefaultEntityInterface.php
7 - modules/custom/demo/src/Entity/DefaultEntity.php
8 - modules/custom/demo/src/DefaultEntityHtmlRouteProvider.php
9 - modules/custom/demo/src/Entity/DefaultEntityViewsData.php
10 - modules/custom/demo/src/DefaultEntityListBuilder.php
11 - modules/custom/demo/src/Form/DefaultEntitySettingsForm.php
12 - modules/custom/demo/src/Form/DefaultEntityForm.php
13 - modules/custom/demo/src/Form/DefaultEntityDeleteForm.php
14 - modules/custom/demo/default_entity.page.inc
15 - modules/custom/demo/templates/default_entity.html.twig
Generated lines: "691"
drupal generate:command
// Welcome to the Drupal Command generator
Enter the extension name [demo]:
>
Enter the Command name. [demo:default]:
>
Do you want to add the initialize method? (yes/no) [no]:
>
Do you want to add the interact method? (yes/no) [no]:
>
Enter the Command Class. (Must end with the word 'Command'). [DefaultCommand]:
>
Is the command aware of the drupal site installation when executed? (yes/no) [no]:
>
Do you want to load services from the container? (yes/no) [no]:
>
Do you want to add a Generator class?. (yes/no) [no]:
>
Do you want proceed with the operation? (yes/no) [yes]:
>
Generated or updated files
Generation path: /Users/hjuarez/drupal/web
1 - modules/custom/demo/src/Command/DefaultCommand.php
2 - modules/custom/demo/console.services.yml
3 - modules/custom/demo/console/translations/en/demo.default.yml
Generated lines: "47"
Closing the issue, maybe the latest version of Drupal Solve the problem.
@enzolutions The problem is not in Drupal core, it is in the way we use https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21Extension.php/class/Extension/8.2.x class. There is a deep problem with structure of the code. We should have used a separate wrapper class around Extension core class, We still can do it, but it requires changes in many places of DC.
Let me one time review our code structure and I will try to find an easy solution
@LOBsTerr Awesome, please refresh your repositories, because we are working actively to try to so a new release 1.9.0 next week.
Hi, I tried to run drupal generate:entity:content
with last version of drupal console (1.9.0) but I always this error. Any have a idea ?
Hi @thuiban
Could you provide information about the environment and how are you testing the command?
Kind regards.
Hi @enzolutions
My env is : Drupal 8.7.2 Drupal Console 1.9.0 Php: 7.3.4 Unix system : Debian
What do you mean about "how are you testing the command" ?
@thuiban how are you executing the command an under what parameters, how is your content type defined ( visually), your content type use any special module to add any field?
Like that:
@thuiban
So the error is in generate:entity:content not in the config:export:content:type as this issue was open it, right? if that is the case is better to open a new issue.
The warning is because the module already exists and we cannot merge the code with the previous code already implemented, that is something that you have to do manually.
If there is another error that I can't see in the image, please attach the rest of the command in execution.
In case I misunderstood your error, please let me know.
@enzolutions
The error:
[ERROR] Warning: call_user_func_array() expects parameter 1 to be a valid callback,
class 'SplFileInfo' does not have a method 'serialize' in <em
class="placeholder">Drupal\Core\Extension\Extension->call() (line 160
of core/lib/Drupal/Core/Extension/Extension.php). <pre
class="backtrace">Drupal\Core\Extension\Extension->call('serialize', Array) (Line: 314)
Drupal\Console\Extension\Manager->createExtension(Object) (Line: 251)
Drupal\Console\Extension\Manager->getModule('palm_custom_module') (Line: 69)
Drupal\Console\Generator\EntityContentGenerator->generate(Array) (Line: 180)
Drupal\Console\Command\Generate\EntityContentCommand->execute(Object, Object) (Line: 255)
Symfony\Component\Console\Command\Command->run(Object, Object) (Line: 987)
Symfony\Component\Console\Application->doRunCommand(Object, Object, Object) (Line: 255)
Symfony\Component\Console\Application->doRun(Object, Object) (Line: 187)
Drupal\Console\Core\Application->doRun(Object, Object) (Line: 64)
Drupal\Console\Application->doRun(Object, Object) (Line: 148)
Symfony\Component\Console\Application->run() (Line: 89)
require('/var/www/html/vendor/drupal/console/bin/drupal.php') (Line: 4)
[ERROR] Warning: call_user_func_array() expects parameter 1 to be a valid callback,
class 'SplFileInfo' does not have a method 'unserialize' in <em
class="placeholder">Drupal\Core\Extension\Extension->call() (line 160
of core/lib/Drupal/Core/Extension/Extension.php). <pre
class="backtrace">Drupal\Core\Extension\Extension->call('unserialize', Array) (Line: 314)
Drupal\Console\Extension\Manager->createExtension(Object) (Line: 251)
Drupal\Console\Extension\Manager->getModule('palm_custom_module') (Line: 69)
Drupal\Console\Generator\EntityContentGenerator->generate(Array) (Line: 180)
Drupal\Console\Command\Generate\EntityContentCommand->execute(Object, Object) (Line: 255)
Symfony\Component\Console\Command\Command->run(Object, Object) (Line: 987)
Symfony\Component\Console\Application->doRunCommand(Object, Object, Object) (Line: 255)
Symfony\Component\Console\Application->doRun(Object, Object) (Line: 187)
Drupal\Console\Core\Application->doRun(Object, Object) (Line: 64)
Drupal\Console\Application->doRun(Object, Object) (Line: 148)
Symfony\Component\Console\Application->run() (Line: 89)
require('/var/www/html/vendor/drupal/console/bin/drupal.php') (Line: 4)
Confirming the bug. I just installed v1.9.0 and now get four of those errors in a row when I add a new entity type to an existing module (drupal generate:entity:content
).
I create about that https://github.com/hechoendrupal/drupal-console/issues/4086
Hi @LOBsTerr Do you have any news about it?
Seeing the error too, Drupal 8.7.8, Console 1.8.0
@kviolka could you try the latest version 1.9.3, please
@enzolutions After updating to console 1.9.4 I can report the SplFileInfo-related error has disappeared.
Problem/Motivation
When trying to export my config the console runs into an error. That happens for every content type i'm trying to export.
Errors
Example Log
Solutions
Didn't tried something yet.