We currently have:
- the TypedData class, which is the base class for "pieces of typed data" (value) objects : a field item, a property...
- the 'typed_data' service (accessed through \Drupal::typedData()), which is not a "piece of typed data", but the TypedDataManager (plugin manager for the above).

So the service id and the associated \Drupal method are misleading when reading code that uses them...
+ Some code use a $this->typedData / $typed_data variable to hold "a piece of typed data", some other to hold "the typed data manager". WTF ;-)

Proposed renames:
- 'typed_data' -> 'typed_data_manager' (like we have the language_manager and entity_manager)
- \Drupal::typedData() -> \Drupal::typedDataManager()
- Go over the $this->typedData / $typed_data variables in core and rename those that refer to the TypedDataManager

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Adding a couple tags - not sure what the right ones are for TypedData ?

plopesc’s picture

Status: Active » Needs review
FileSize
27.77 KB

Patch renaming typed_data service to typed_data_manager and converting *->typedData / $typed_data references to *->typedDataManager / $typed_data_manager when refer to TypedDataManager.

Let's see testbot...

Status: Needs review » Needs work

The last submitted patch, 2: rename_typed_data-2132145-1.patch, failed testing.

plopesc’s picture

Status: Needs work » Needs review
FileSize
28.9 KB
1.76 KB

Sorry, I forgot to include test files...

Berdir’s picture

Component: entity system » typed data system
Status: Needs review » Reviewed & tested by the community

Makes sense. The name is because the function was called typed_data() and it predated the concept of plugin managers.

yched’s picture

Yay, thanks @plopesc !

@Berdir: ah true, typed data API was not plugin-based initially. Makes sense.

(+ lol at #2125679: "name" in issue titles is replaced with "Drupal.org" in page title, especially funny here...)

Xano’s picture

Berdir’s picture

The last submitted patch, 4: rename_typed_data-2132145-4.patch, failed testing.

plopesc’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
28.84 KB

Re-rolling...

Xano’s picture

FileSize
28.84 KB

Re-roll.

plopesc’s picture

New Re-roll

yched’s picture

Status: Needs review » Reviewed & tested by the community

Still RTBC if green.

Side note: when rerolling RTBC patches, unless there are other changes besides the reroll, it's best to leave them at RTBC, the bot will kick back to "needs work" if the reroll causes test fails. Otherwise the issue easily drops out of the radar :-)

LinL’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: rename_typed_data-2132145-12.patch, failed testing.

plopesc’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
29.01 KB

Re-roll

plopesc’s picture

amateescu’s picture

Fixed some unneeded empty lines.

yched’s picture

No commit :(
Probably needs a reroll ?

18: rename_typed_data-2132145-18.patch queued for re-testing.

yched’s picture

Issue tags: +Avoid commit conflicts
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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