0

I am adding paragraphs from xml file programmatically but it is extremely slow. for example I'm basically creating paragraphs like this:

$row = ['field_title' => 'title', 'field_id' => 'id' ....];
$paragraph = \Drupal::entityTypeManager()->getStorage('paragraph')->create($row);

I have at least ten paragraphs for node and it is taking approximately 2-3 minutes to create for one paragraph.

What can be the problem?

  • Where do you write that code? – user72672 Sep 13 '19 at 13:09
  • when importing data in drush commands php. It is creating paragraph but it is exteremely slow. – tasqyn Sep 13 '19 at 13:10
  • 1
    You don't need to save the newly created paragraph, new paragraphs get saved automatically when the parent entity is saved. – 4k4 Sep 14 '19 at 9:09
  • Yes you are right but it is still slow. – tasqyn Sep 16 '19 at 8:01
  • Have you tried running it on a better computer to make sure your hardware/software configuration isn't the problem? – Clive Sep 16 '19 at 8:43

Your Answer

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

Browse other questions tagged or ask your own question.