private function computeReferrerChanges($mapping, $referrer)
    {
        $targetClass = $this->dm->getClassMetadata(get_class($referrer));
        $state = $this->getDocumentState($referrer);

        switch ($state) {
            case self::STATE_NEW:
                if (!($mapping['cascade'] & ClassMetadata::CASCADE_PERSIST)) {
                    throw CascadeException::newDocumentFound(self::objToStr($referrer));
                }
                $this->persistNew($targetClass, $referrer);
                $this->computeChangeSet($targetClass, $referrer);
                break;
            case self::STATE_DETACHED:
                throw new InvalidArgumentException('A detached document was found through a referrer during cascading a persist operation: '.self::objToStr($referrer, $this->dm));
        }
    }
private function computeReferrerChanges($mapping, $referrer)
    {
        $targetClass = $this->dm->getClassMetadata(get_class($referrer));
        $state = $this->getDocumentState($referrer);

        switch ($state) {
            case self::STATE_NEW:
                if (!($mapping['cascade'] & ClassMetadata::CASCADE_PERSIST)) {
                    throw CascadeException::newDocumentFound(self::objToStr($referrer));
                }
                $this->persistNew($targetClass, $referrer);
                $this->computeChangeSet($targetClass, $referrer);
                break;
            case self::STATE_DETACHED:
                throw new InvalidArgumentException('A detached document was found through a referrer during cascading a persist operation: '.self::objToStr($referrer, $this->dm));
        }
    }
private function computeReferrerChanges ( $ mapping , $ referrer ) { $ targetClass = $ this -> dm -> getClassMetadata ( get_class ( $ referrer ) ) ; $ state = $ this -> getDocumentState ( $ referrer ) ; switch ( $ state ) { case self :: STATE_NEW : if ( ! ( $ mapping [ 'cascade' ] & ClassMetadata :: CASCADE_PERSIST ) ) { throw CascadeException :: newDocumentFound ( self :: objToStr ( $ referrer ) ) ; } $ this -> persistNew ( $ targetClass , $ referrer ) ; $ this -> computeChangeSet ( $ targetClass , $ referrer ) ; break ; case self :: STATE_DETACHED : throw new InvalidArgumentException ( 'A detached document was found through a referrer during cascading a persist operation: ' . self :: objToStr ( $ referrer , $ this -> dm ) ) ; } }
Computes the changes of a referrer.

@param array $mapping  the mapping data
@param mixed $referrer the referenced document.
Computes the changes of a referrer .