eloquent-driver icon indicating copy to clipboard operation
eloquent-driver copied to clipboard

origin_id in localized entries are causing error

Open j3ll3yfi5h opened this issue 3 years ago • 3 comments

I was trying to import 8804 entries from a current page with php please eloquent:import-entries.

It stopped with:

Call to a member function id() on string

  at vendor/statamic/eloquent-driver/src/Entries/Entry.php:46
     42▕         }
     43▕
     44▕         return $class::findOrNew($this->id())->fill([
     45▕             'id'         => $this->id(),
  ➜  46▕             'origin_id'  => $this->origin()?->id(),
     47▕             'site'       => $this->locale(),
     48▕             'slug'       => $this->slug(),
     49▕             'uri'        => $this->uri(),
     50▕             'date'       => $this->hasDate() ? $this->date() : null,

When I removed the translated data folders (with about 587 entries), it finishes without any problems. Any ideas?

Statamic 3.3.43 Pro Laravel 8.83.25 PHP 8.0.16 statamic/collaboration 0.4.0 statamic/eloquent-driver 1.0.1

j3ll3yfi5h avatar Oct 15 '22 19:10 j3ll3yfi5h

Interesting one - at a guess I'd say its because its inserting the translation before the origin. Would there be any chance of giving me access to the data so I can try and come up with a work around? I've unfortunately not got access to a site with so many translated entries to work against.

ryanmitchell avatar Oct 16 '22 17:10 ryanmitchell

You're completely right! I just readded them and it finished importing without any problems.

j3ll3yfi5h avatar Oct 16 '22 20:10 j3ll3yfi5h

Great - that’s good to know. I’ll refactor the import to run those without an origin first.

ryanmitchell avatar Oct 16 '22 20:10 ryanmitchell