public function _apply($oldValue, $object, $key)
    {
        if ($oldValue == null)
        {
            return new AVRelation($object, $key, $this->targetClassName);
        } else if ($oldValue instanceof AVRelation)
        {
            if ($this->targetClassName != null && $oldValue->getTargetClass() !== $this->targetClassName)
            {
                throw new \Exception('Related object object must be of class ' . $this->targetClassName . ', but ' . $oldValue->getTargetClass() . ' was passed in.');
            }

            return $oldValue;
        } else
        {
            throw new \Exception("Operation is invalid after previous operation.");
        }
    }
public function _apply($oldValue, $object, $key)
    {
        if ($oldValue == null)
        {
            return new AVRelation($object, $key, $this->targetClassName);
        } else if ($oldValue instanceof AVRelation)
        {
            if ($this->targetClassName != null && $oldValue->getTargetClass() !== $this->targetClassName)
            {
                throw new \Exception('Related object object must be of class ' . $this->targetClassName . ', but ' . $oldValue->getTargetClass() . ' was passed in.');
            }

            return $oldValue;
        } else
        {
            throw new \Exception("Operation is invalid after previous operation.");
        }
    }
public function _apply ( $ oldValue , $ object , $ key ) { if ( $ oldValue == null ) { return new AVRelation ( $ object , $ key , $ this -> targetClassName ) ; } else if ( $ oldValue instanceof AVRelation ) { if ( $ this -> targetClassName != null && $ oldValue -> getTargetClass ( ) !== $ this -> targetClassName ) { throw new \ Exception ( 'Related object object must be of class ' . $ this -> targetClassName . ', but ' . $ oldValue -> getTargetClass ( ) . ' was passed in.' ) ; } return $ oldValue ; } else { throw new \ Exception ( "Operation is invalid after previous operation." ) ; } }
Applies the current operation and returns the result.

@param mixed $oldValue Value prior to this operation.
@param mixed $object Value for this operation.
@param string $key Key to perform this operation on.

@return mixed Result of the operation.

@throws \Exception
Applies the current operation and returns the result .