public function getPropertyValue($entity, $field, $default = null)
    {
        $this->assertEntity($entity);

        if (is_array($entity) || $entity instanceof \ArrayAccess) {
            return isset($entity[$field]) ? $entity[$field] : $default;
        }

        $ref = $this->getReflection($entity);
        if (!$ref->hasProperty($field)) {
            return isset($entity->{$field}) ? $entity->{$field} : $default;
        }

        return $this->getProperty($ref, $field)->getValue($entity);
    }