public function mapper($entity, $entityMap = null)
    {
        if ($entity instanceof Wrapper) {
            throw new MappingException('Tried to instantiate mapper on wrapped Entity');
        }

        $entity = $this->resolveEntityClass($entity);

        $entity = $this->getInverseMorphMap($entity);

        // Return existing mapper instance if exists.
        if (array_key_exists($entity, $this->mappers)) {
            return $this->mappers[$entity];
        } else {
            return $this->buildMapper($entity, $entityMap);
        }
    }
public function mapper($entity, $entityMap = null)
    {
        if ($entity instanceof Wrapper) {
            throw new MappingException('Tried to instantiate mapper on wrapped Entity');
        }

        $entity = $this->resolveEntityClass($entity);

        $entity = $this->getInverseMorphMap($entity);

        // Return existing mapper instance if exists.
        if (array_key_exists($entity, $this->mappers)) {
            return $this->mappers[$entity];
        } else {
            return $this->buildMapper($entity, $entityMap);
        }
    }
public function mapper ( $ entity , $ entityMap = null ) { if ( $ entity instanceof Wrapper ) { throw new MappingException ( 'Tried to instantiate mapper on wrapped Entity' ) ; } $ entity = $ this -> resolveEntityClass ( $ entity ) ; $ entity = $ this -> getInverseMorphMap ( $ entity ) ; // Return existing mapper instance if exists. if ( array_key_exists ( $ entity , $ this -> mappers ) ) { return $ this -> mappers [ $ entity ] ; } else { return $ this -> buildMapper ( $ entity , $ entityMap ) ; } }
Create a mapper for a given entity.

@param \Analogue\ORM\Mappable|string|array|\Traversable $entity
@param mixed                                            $entityMap

@throws MappingException
@throws \InvalidArgumentException

@return Mapper
Create a mapper for a given entity .