protected function assertInstance($entity)
    {
        $entityClass = $this->definition->entity();
        if (!$entity instanceof $entityClass) {
            throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
        }

        return true;
    }
protected function assertInstance($entity)
    {
        $entityClass = $this->definition->entity();
        if (!$entity instanceof $entityClass) {
            throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
        }

        return true;
    }
protected function assertInstance ( $ entity ) { $ entityClass = $ this -> definition -> entity ( ) ; if ( ! $ entity instanceof $ entityClass ) { throw new RelationException ( sprintf ( 'Relation entity must be instance of %s, got %s' , $ entityClass , $ this -> getType ( $ entity ) ) ) ; } return true ; }
Throws exception when entity is not required instance

@param mixed $entity

@return bool
@throws RelationException
Throws exception when entity is not required instance