Skip to content

ReflectionProperty is deprecated in ORM 3.5+ #3032

@Jean85

Description

@Jean85

ReflectionProperty in ORM si deprecated since 3.5: doctrine/orm#12083
The replacement is PropertyAccessor, which is available since 3.4: doctrine/orm#11659

PropertyAccessor has setValue and getValue methods, which should be sufficient for all uses in this library. I performaed a quick scan of the codebase and found only ->setAccessible(true) as an other method called onto ReflectionProperty (which are obtained via ClassMetaData::getReflectionProperty).

Would it be acceptable to create a small static wrapper like this?

function getProperty(ClassMetadata $meta): ReflectionProperty|PropertyAccessor|null
{
    if (method_exists(ClassMetadata::class, 'getPropertyAccessor')) {
        return $meta->getPropertyAccessor();
    }

    return $meta->getReflectionProperty();
}

...and use it everywhere in the codebase to solve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions