Problem/Motivation

Recently a new method named isAvailableForRegistration was added to the HostEntityInterface. This method is very useful, but has one drawback in that it is sensitive to the registration count for a given host entity through its HasRoom validator, and has to do a count query on the registration table, which is relatively expensive. Thus it is not suitable for use in access control where performance is paramount.

Introducing a new method isOpenForRegistration can do all the same checks as isAvailable except the HasRoom and AllowedRegistrant checks. This new method can be used in access control and various field formatters to simplify the code.

Note: The doc block for this and isAvailable will need to reference each other via @see and be very clear about when to use which one and how they differ.

This method allows the "set and forget" feature to be deprecated, since access checking that automatically recalculates based on settings open and close dates makes it unnecessary.

Steps to reproduce

Proposed resolution

Add the new method and use it in access control and various field formatters where applicable.

Remaining tasks

User interface changes

API changes

Data model changes

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

john.oltman created an issue. See original summary.

john.oltman’s picture

Issue summary: View changes
jonathanshaw’s picture

Yes, if we use this for the access it makes sense to have it.

  • john.oltman committed 63a75d9e on 3.3.x
    #3505948: Add new HostEntity method isOpenForRegistration
    
john.oltman’s picture

Assigned: john.oltman » Unassigned
Status: Active » Fixed
john.oltman’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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