public function prepareLookup()
    {
        $value = $this->rhs;

        if ($this->rhsValueIsIterable) {
            $this->rhs = array_map(function ($value) {
                return static::getNomalizedValue($value, $this->lhs);
            }, $this->rhs);

            // we validate the fields get approprite value type
            // e.g a foreignkey of type integer should not get a value like 'abc'
            if (method_exists($this->lhs, 'getPathInfo')) {
                $path = $this->lhs->getOutputField()->getPathInfo();
                $sources = end($path)['targetFields'];

                /** @var $targetField Field* */
                $targetField = end($sources);

                $this->rhs = array_map(function ($value) use ($targetField) {
                    return $targetField->prepareValue($value);
                }, $this->rhs);
            }
        } else {
            $this->rhs = static::getNomalizedValue($value, $this->lhs);
            if (method_exists($this->rhs, '_prepare')) {
                return $this->rhs->_prepare($this->lhs->getOutputField());
            }

            if ($this->prepareRhs && method_exists($this->lhs->getOutputField(),
                    'prepareValue')) {
                return $this->lhs->getOutputField()->prepareValue($this->rhs);
            }
        }

        // it might be, this is just a pure php value
        return $this->rhs;
    }
public function prepareLookup()
    {
        $value = $this->rhs;

        if ($this->rhsValueIsIterable) {
            $this->rhs = array_map(function ($value) {
                return static::getNomalizedValue($value, $this->lhs);
            }, $this->rhs);

            // we validate the fields get approprite value type
            // e.g a foreignkey of type integer should not get a value like 'abc'
            if (method_exists($this->lhs, 'getPathInfo')) {
                $path = $this->lhs->getOutputField()->getPathInfo();
                $sources = end($path)['targetFields'];

                /** @var $targetField Field* */
                $targetField = end($sources);

                $this->rhs = array_map(function ($value) use ($targetField) {
                    return $targetField->prepareValue($value);
                }, $this->rhs);
            }
        } else {
            $this->rhs = static::getNomalizedValue($value, $this->lhs);
            if (method_exists($this->rhs, '_prepare')) {
                return $this->rhs->_prepare($this->lhs->getOutputField());
            }

            if ($this->prepareRhs && method_exists($this->lhs->getOutputField(),
                    'prepareValue')) {
                return $this->lhs->getOutputField()->prepareValue($this->rhs);
            }
        }

        // it might be, this is just a pure php value
        return $this->rhs;
    }
public function prepareLookup ( ) { $ value = $ this -> rhs ; if ( $ this -> rhsValueIsIterable ) { $ this -> rhs = array_map ( function ( $ value ) { return static :: getNomalizedValue ( $ value , $ this -> lhs ) ; } , $ this -> rhs ) ; // we validate the fields get approprite value type // e.g a foreignkey of type integer should not get a value like 'abc' if ( method_exists ( $ this -> lhs , 'getPathInfo' ) ) { $ path = $ this -> lhs -> getOutputField ( ) -> getPathInfo ( ) ; $ sources = end ( $ path ) [ 'targetFields' ] ; /** @var $targetField Field* */ $ targetField = end ( $ sources ) ; $ this -> rhs = array_map ( function ( $ value ) use ( $ targetField ) { return $ targetField -> prepareValue ( $ value ) ; } , $ this -> rhs ) ; } } else { $ this -> rhs = static :: getNomalizedValue ( $ value , $ this -> lhs ) ; if ( method_exists ( $ this -> rhs , '_prepare' ) ) { return $ this -> rhs -> _prepare ( $ this -> lhs -> getOutputField ( ) ) ; } if ( $ this -> prepareRhs && method_exists ( $ this -> lhs -> getOutputField ( ) , 'prepareValue' ) ) { return $ this -> lhs -> getOutputField ( ) -> prepareValue ( $ this -> rhs ) ; } } // it might be, this is just a pure php value return $ this -> rhs ; }
Preperes the rhs for use in the lookup.

@return mixed

@throws \Eddmash\PowerOrm\Exception\FieldDoesNotExist
@throws \Eddmash\PowerOrm\Exception\FieldError
@author: Eddilbert Macharia (http://eddmash.com)<edd.cowan@gmail.com>
Preperes the rhs for use in the lookup .