FR: Service API Additions
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Presently, with some Craft services, there exist functions such as the following:
\craft\services\Fields::deleteFieldById()
\craft\services\Fields::deleteField()
These functions allow objects managed by the service to be deleted via providing an ID, or providing the object itself, respectively. However, there are a few cases where there is only a ById form of these functions, such as \craft\services\Categories::deleteGroupById(), and \craft\services\Structures::deleteStructureById(), among others.
For consistency, it would be nice to see equivalent functions added for these services. If this sounds like a good idea, I could create a PR with these changes.
Additionally, there are two instances of function names that seem inconsistent with the rest of the definitions:
\craft\services\Tags::deleteTagGroup() and \craft\services\Tags::deleteTagGroupById() specify their group types, whereas the other services that manage some kind of 'group' object leave off the type name, and simply use deleteGroup and similar. This is the case with Categories, Fields, Sites, and UserGroups.
\craft\services\AssetTransforms::deleteTransform() Takes an ID instead of a transform itself, which it then uses to find an appropriate transform.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the service entry points named in the issue, including Categories::deleteGroupById(), Structures::deleteStructureById(), Tags::deleteTagGroup(), and AssetTransforms::deleteTransform(). Determine the complete set of inconsistent deletion APIs and make the naming and object-versus-ID behavior consistent across the affected services; done means the service definitions and their coverage agree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100