public function resolveReverseProperty(Model $source, $propName)
    {
        if (!is_string($propName)) {
            throw new InvalidOperationException('Property name must be string');
        }
        $entity = $this->getObjectMap()->resolveEntity(get_class($source));
        if (null === $entity) {
            $msg = 'Source model not defined';
            throw new \InvalidArgumentException($msg);
        }
        $association = $entity->resolveAssociation($propName);

        if (null === $association) {
            return null;
        }
        $isFirst = $propName === $association->getFirst()->getRelationName();
        if (!$isFirst) {
            return $association->getFirst()->getRelationName();
        }

        if (!$association instanceof AssociationMonomorphic) {
            throw new InvalidOperationException('');
        }
        return $association->getLast()->getRelationName();
    }
public function resolveReverseProperty(Model $source, $propName)
    {
        if (!is_string($propName)) {
            throw new InvalidOperationException('Property name must be string');
        }
        $entity = $this->getObjectMap()->resolveEntity(get_class($source));
        if (null === $entity) {
            $msg = 'Source model not defined';
            throw new \InvalidArgumentException($msg);
        }
        $association = $entity->resolveAssociation($propName);

        if (null === $association) {
            return null;
        }
        $isFirst = $propName === $association->getFirst()->getRelationName();
        if (!$isFirst) {
            return $association->getFirst()->getRelationName();
        }

        if (!$association instanceof AssociationMonomorphic) {
            throw new InvalidOperationException('');
        }
        return $association->getLast()->getRelationName();
    }
public function resolveReverseProperty ( Model $ source , $ propName ) { if ( ! is_string ( $ propName ) ) { throw new InvalidOperationException ( 'Property name must be string' ) ; } $ entity = $ this -> getObjectMap ( ) -> resolveEntity ( get_class ( $ source ) ) ; if ( null === $ entity ) { $ msg = 'Source model not defined' ; throw new \ InvalidArgumentException ( $ msg ) ; } $ association = $ entity -> resolveAssociation ( $ propName ) ; if ( null === $ association ) { return null ; } $ isFirst = $ propName === $ association -> getFirst ( ) -> getRelationName ( ) ; if ( ! $ isFirst ) { return $ association -> getFirst ( ) -> getRelationName ( ) ; } if ( ! $ association instanceof AssociationMonomorphic ) { throw new InvalidOperationException ( '' ) ; } return $ association -> getLast ( ) -> getRelationName ( ) ; }
Resolve possible reverse relation property names.

@param Model $source
@param $propName
@return null|string
@internal param Model $target
Resolve possible reverse relation property names .