public function setEntity($entity = array())
    {
        // check if only one entry is given
        if (count($entity) <> 1) {
            throw new \InvalidArgumentException('Must be set with one key/value-pair!');
        }

        // fetch key from parameter
        $_tmp = array_keys($entity);
        $key  = array_pop($_tmp);

        // check if the key of the given array exists
        if (array_key_exists($key, $this->entityList)) {
            // check if value exists for key
            if (in_array($entity[$key], $this->entityList[$key])) {
                $this->defaultOptions['entity'] = $entity;
            }
        }

        return $this;
    }
public function setEntity($entity = array())
    {
        // check if only one entry is given
        if (count($entity) <> 1) {
            throw new \InvalidArgumentException('Must be set with one key/value-pair!');
        }

        // fetch key from parameter
        $_tmp = array_keys($entity);
        $key  = array_pop($_tmp);

        // check if the key of the given array exists
        if (array_key_exists($key, $this->entityList)) {
            // check if value exists for key
            if (in_array($entity[$key], $this->entityList[$key])) {
                $this->defaultOptions['entity'] = $entity;
            }
        }

        return $this;
    }
public function setEntity ( $ entity = array ( ) ) { // check if only one entry is given if ( count ( $ entity ) <> 1 ) { throw new \ InvalidArgumentException ( 'Must be set with one key/value-pair!' ) ; } // fetch key from parameter $ _tmp = array_keys ( $ entity ) ; $ key = array_pop ( $ _tmp ) ; // check if the key of the given array exists if ( array_key_exists ( $ key , $ this -> entityList ) ) { // check if value exists for key if ( in_array ( $ entity [ $ key ] , $ this -> entityList [ $ key ] ) ) { $ this -> defaultOptions [ 'entity' ] = $ entity ; } } return $ this ; }
Set the entity for the result

@param array $entity

@throws \InvalidArgumentException

@return Tunes
Set the entity for the result