File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,14 +58,17 @@ public function handle(): void
5858
5959 protected function findOrCreateEntry (array $ data ): void
6060 {
61+ $ entry = null ;
6162 $ collection = Collection::find ($ this ->import ->get ('destination.collection ' ));
6263 $ site = Site::get ($ this ->import ->get ('destination.site ' ) ?? Site::default ()->handle ());
6364
64- $ entry = Entry::query ()
65- ->where ('site ' , $ site ->handle ())
66- ->where ('collection ' , $ collection ->handle ())
67- ->where ($ this ->import ->get ('unique_field ' ), $ data [$ this ->import ->get ('unique_field ' )])
68- ->first ();
65+ if ($ uniqueFieldValue = Arr::get ($ data , $ this ->import ->get ('unique_field ' ))) {
66+ $ entry = Entry::query ()
67+ ->where ('site ' , $ site ->handle ())
68+ ->where ('collection ' , $ collection ->handle ())
69+ ->where ($ this ->import ->get ('unique_field ' ), $ uniqueFieldValue )
70+ ->first ();
71+ }
6972
7073 if (! $ entry ) {
7174 if (! in_array ('create ' , $ this ->import ->get ('strategy ' ))) {
You can’t perform that action at this time.
0 commit comments