Test that the index field is not empty

We have a case where it is possible that someone is passing in data that may or may not have been saved to our DB already. In this case these index fields may be empty as such there is no reason to try to retrieve it.
:+1:

Interesting indeed!


On 25 Aug 2014, at 20:22, gnat42 <notifications@github.com> wrote:

> In src/Ddeboer/DataImport/Writer/DoctrineWriter.php:
> 
> > @@ -180,9 +180,11 @@ public function writeItem(array $item)
> >          // first
> >          if (false === $this->truncate) {
> >              if ($this->index) {
> > -                $entity = $this->entityRepository->findOneBy(
> > -                    array($this->index => $item[$this->index])
> > -                );
> > +                if(isset($item[$this->index]) && !empty($item[$this->index])) {
> Hmm interesting. So isset() is equivalent to (isset() && !is_null()) and empty() is the same as (isset() && !empty()). That I never actually knew. So I'll modify for to !empty() then.
> 
> —
> Reply to this email directly or view it on GitHub.
>