In the content generating process I've got this:

bug

Comments

drugan created an issue. See original summary.

drugan’s picture

StatusFileSize
new622 bytes
drugan’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 2938241-2.patch, failed testing. View results

alberto56’s picture

Status: Needs work » Postponed (maintainer needs more info)

Hi, thanks for the report, and the patch.

Note that you have filed this against 8.x-1.x, but 8.x-2.x is the supported branch. Can you please confirm you are using the supported version and set it in the issue information? Please re-trigger the test as well. You can also, if you are comfortable doing so, create a pull request against https://github.com/dcycle/realistic_dummy_content/tree/8.x-2.x (and reference it here) which will trigger more detailed tests.

Also, I would like to confirm why this happens and add that scenario to my automated tests -- if you know what type of field and data caused this can you please specify it here?

Thanks!

drugan’s picture

Status: Postponed (maintainer needs more info) » Needs work
StatusFileSize
new151.86 KB

Well, I am not sure, because what I did is the following:

Go to https://www.drupal.org/project/realistic_dummy_content/git-instructions and choose 8.x-2.x branch to clone.

git clone --branch 8.x-2.x https://git.drupal.org/project/realistic_dummy_content.git
cd realistic_dummy_content

Make changes and then the patch:

git diff > 2938241-2.patch

Uploaded the patch then reset the changes and did this:

reapplied

drugan’s picture

alberto56’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev

Thanks, I'll set the version of this ticket to 8.x-2.x then. I also started an automated test on Circle CI at https://circleci.com/gh/dcycle/realistic_dummy_content/115 to see if your patch breaks anything.

Are you using this in conjunction with any custom code, or just out of the box?

drugan’s picture

I am trying to extend "DevelGenerate" plugin to generate Drupal Commerce entities, particularly products. Again, I am not sure but for me it seems that the error emitted because GenerateProducts.php plugin instance is just a stub and does not return anything for now. However, for me it seems that the RDC module should not react for such a case even if some module makes an erroneous or incomplete "DevelGenerate" plugin's implementation. Moreover, the error arises while generating content, not product entities.

BTW, your module is great and I have a thought to recommend it for using along with the Commerce Generate module. There is only one minor issue which I discovered. When I try to generate content (Articles) it does not make more than 15 nodes and gives the server 60 seconds timeout error. I've looked into the code but got a bit confused as D7 and D8 code is intermingled and difficult to sort out (at least for me personally). Did you think about separating code bases? Please, though as a proof of concept it looks great but in a practical sense it just makes things overcomplicated without any necessity for it.

alberto56’s picture

Thanks for the detailed info and I'm glad you're finding the module useful.

for me it seems that the RDC module should not react for such a case even if some module makes an erroneous or incomplete "DevelGenerate" plugin's implementation

Agreed. However before the patch, I am assuming that value is either an array with the key 'set', or a string. Assigning $value to be the value of $value['set'] might cause some other problems because perphaps $value is already an array, just not having the key 'set'. Then we'd end up with something like ['set' => [some random array], which might break something else.

Instead, how about something like:

if (is_array($value) && !isset($value['set'])) {
drupal_set_message('Not setting an attribute because the data is invalid.', 'error');
return;
}

That way we're not completely breaking but we're not trying to do something with invalid data.

I am trying to extend "DevelGenerate" plugin to generate Drupal Commerce entities, particularly products

I love that idea, and would love to be posted about the progress of that project. If it's open source, you might want to paste the repo URL here.

it does not make more than 15 nodes and gives the server 60 seconds timeout error

I think that is because of #1242352: Don't hard code the 50 node threshold for triggering batch node generation; one way around this is to only use drush, not the GUI, that works for me.

Did you think about separating code bases? Please, though as a proof of concept it looks great but in a practical sense it just makes things overcomplicated

Yeah I tried that just to see if it's possible, plus I don't have the resources to maintain two versions (7 and 8) of realistic dummy content, so it sounded like a good idea... at the time, but I agree it's overly complex. If you have any patches you'd like to submit which do not fit in the "universal code" setup, I'd be glad to tweak them. If you'd like to open an issue discussing separating the two codebases, please do. Please note, though, that although I agree it's overly complex, some complexity is still needed just to make the code unit-testable as well.

drugan’s picture

Status: Needs work » Needs review
StatusFileSize
new687 bytes

Yes, you're right there the data should be checked if it is the array which has expected structure. Otherwise the error should be emitted to warn a user that something is wrong.

As for the threshold issue I've fixed this on the Commerce Generate module (submodule of the Commerce Bulk) by exposing this configuration to a user on the plugin settings form. Environments are different, products also might have a huge volume so let user to decide when to start batch process or make it in one go. See more how it is done in code:

http://cgit.drupalcode.org/commerce_bulk/tree/modules/commerce_generate/...

alberto56’s picture

Status: Needs review » Needs work

This is failing at https://circleci.com/gh/dcycle/realistic_dummy_content/116 with "Illegal string offset 'set' Drupal8.php:247"

I think it's because we need to keep these lines:

-    if (!is_array($value)) {
-      $value = array('set' => $value);

Feel free to modify your pull request at https://github.com/dcycle/realistic_dummy_content/pull/18 directly, that should now trigger tests on Circle CI.

Thanks also for the link to your code, I've often needed to generate content for Drupal Commerce. When it's ready I'll link to it in the Realistic Dummy Content home page.

drugan’s picture

I've looked into the test results and think that the whole reason is much more complex than just changing the if() condition. This code requires deeper debugging and I'll do it as soon as I have time for this. For now this and threshold issues are keeping me out from adding RDC to "suggest" section in the Commerce generate module's composer.json. Having realistic images and textual content is vital for commerce products. Also, I think that CG might be used in conjunction with RDC not only for dev purposes but also for bulk generating of products which could be used for realistic :) sale. Why not? Just think of it: you'd made some simple preparation work (according instructions in the docs) and then get a ton of ready to sale products by pressing a button only once! *dreaming...

Of course, this requires a lot of coding and testing.

  • drugan authored 21d8cf6 on 8.x-2.x
    Issue #2938241 by drugan: Error: Undefined index: set (#18)
    
    Co-authored...
alberto56’s picture

Status: Needs work » Fixed

This is now passing tests so I have included it here.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.