Problem/Motivation

The docblock for Drupal\file\FileRepositoryInterface::writeData() has this line:
Writes a file to the specified destination and creates a file entity.

However, the implementation in Drupal\file\FileRepository::writeData() calls Drupal\file\FileRepository::createOrUpdate(), where if there is an existing file entity matching the URI where the file data is saved on disk, the file is loaded and saved, and no new file entity is created.

The documentation then is misleading.

Steps to reproduce

Proposed resolution

Update the docblock in Drupal\file\FileRepositoryInterface::writeData() to indicate it will either update a matching file entity or create a new file entity.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3511456

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

godotislate created an issue. See original summary.

aldibier made their first commit to this issue’s fork.

arunsahijpal’s picture

Working on it.

arunsahijpal’s picture

Status: Active » Needs review

Hi @godotislate,
I've updated the docblock, pls check.

godotislate’s picture

Status: Needs review » Reviewed & tested by the community

lgtm

godotislate’s picture

@arusahijpal Can you re-run the failing jobs in the pipeline? They should be unrelated, but it's better to make sure the tests are all green.

arunsahijpal’s picture

@godotislate,
I ran the pipeline again but it is still failing.

nod_ made their first commit to this issue’s fork.

catch made their first commit to this issue’s fork.

catch’s picture

Version: 11.x-dev » 10.5.x-dev
Status: Reviewed & tested by the community » Fixed

The pipeline wasn't happy, although there shouldn't be any reason the docs would affect anything, but just for paranoia's sake I tried to re-run it again, got a vendor directory not found error, so rebase the branch, and that pipeline passed after a couple of random failures.

Committed/pushed to 11.x, thanks!

  • catch committed 5566cb83 on 10.5.x
    Issue #3511456 by arunsahijpal, godotislate: Documentation for...

  • catch committed 67e7a25f on 11.x
    Issue #3511456 by arunsahijpal, godotislate: Documentation for...
catch’s picture

Status: Fixed » Closed (fixed)

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