Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Service API Additions #2992

Open
sbossarte opened this issue Jun 13, 2018 · 1 comment
Open

FR: Service API Additions #2992

sbossarte opened this issue Jun 13, 2018 · 1 comment

Comments

@sbossarte
Copy link
Contributor

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.

@brandonkelly
Copy link
Member

If you have the time we’d certainly welcome a PR :)

As far as fixing naming inconsistencies goes, we’ll need to maintain all current methods for backwards compatibility, but they can be deprecated and just wrap the new method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants