Problem/Motivation

Core is moving from Doctrine annotations to PHP attributes, so we should too.

Although I have created an MR, I don't understand Attributes or Annotations well, so I would highly appreciate anyone who steps up and wants to work on this issue.

The current working branch is attributes_refactor. The test failures are caused by AnnotationNormalizer in jsonapi_discovery, which needs to be updated to support attributes.

Issue fork jsonrpc-3471347

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ptmkenny created an issue. See original summary.

ptmkenny’s picture

Status: Active » Postponed

This can be part of the 3.0 release.

ptmkenny’s picture

Version: 2.x-dev » 3.x-dev
Status: Postponed » Active

ptmkenny’s picture

Status: Active » Needs work
ptmkenny’s picture

Issue summary: View changes
ptmkenny’s picture

Comment from fathershawn on Slack:

Both classes are essentially data objects. As I see it, they are related but not embodied in the same class.
Your instance of AttributeInterface powers discovery of your plugin classes and manages the metadata needed to instantiate them.
DefaultPluginManager::getDiscovery instantiates AttributeClassDiscovery
DefaultPluginManager extends PluginManagerBase and PluginManagerBase::getDefinitions passes it’s work to the discovery class. AttributeClassDiscovery::getDefinitions ultimately calls AttributeInterface::get to get the data from the attribute which has a return type of mixed and AttributeBase refines that as array|object . Which means that in the ::get method of your attribute you can return an instance of PluginDefinitionInterface
See \Drupal\Core\Layout\Attribute\Layout for an example.

ptmkenny’s picture

Status: Postponed » Needs work
ptmkenny’s picture

Issue summary: View changes

ptmkenny changed the visibility of the branch attributes to hidden.

ptmkenny changed the visibility of the branch attributes_claude to hidden.

ptmkenny changed the visibility of the branch attributes_refactor2 to hidden.

ptmkenny’s picture

ptmkenny’s picture

Title: Migrate from Doctrine annotations to PHP attributes » Add support for PHP attributes

  • ptmkenny committed de24afc9 on 3.x
    Issue #3471347 by ptmkenny: Add support for PHP attributes
    
ptmkenny’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.