• Resolved peter8nss

    (@peter8nss)


    I’m using the ORM to create organisers so my code includes the following:

    $organizer = tribe_organizers()->set_args( $args )->create();

    But when I do code analysis with phpstan I get the following error:

    Call to an undefined method Tribe__Repository__Update_Interface::create()

    I think this is because function tribe_organizers() returns Tribe__Repository__Interface which is defined as:

    interface Tribe__Repository__Interface extends
    Repository_Interface,
    Tribe__Repository__Read_Interface,
    Tribe__Repository__Update_Interface

    And Tribe__Repository__Update_Interface is defined as

    interface Tribe__Repository__Update_Interface extends Tribe__Repository__Setter_Interface 

    And set_args is part of Tribe__Repository__Setter_Interface. So far so good. But set_args header has @return Tribe__Repository__Update_Interface. Unfortunately, create method is actually on Repository_Interface not Tribe__Repository__Update_Interface, hence the error reported.

    I think the header for set_args should be changed to:

    * @return Repository_Interface
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support tristan083

    (@tristan083)

    Hi @peter8nss ,

    Thank you for reaching out and bringing this to our attention. I’ll be sure to share this feedback with our products/development team for consideration on our future updates/releases.

    Plugin Support Darian

    (@d0153)

    Hi there,

    Since this thread has been inactive for a while, I’ll go ahead and close it for now. If you have any additional questions or need further assistance, please feel free to reopen the thread or start a new one. We’re always happy to help!

    maxm123

    (@maxm123)

    Hi there,

    we faced the same challenge, so I want to emphasize that this issue persists and contribute some details on the source of the problem. The change that introduced the typing chaos happens in Commit b428a91: Custom table repository (github).

    The removal of create, save, delete (and various others) methods from the traditional interfaces in ‎src/Tribe/Repository breaks the carefully constructed interface segregation and thus the typing of (fluent-applying) call sites. Those methods were moved to a new interface Repository_Interface in TEC\Common\Contracts which is not integrated into the type hierarchy except for a sub typing relation of the strongest interface Tribe__Repository__Interface.

    Hope this helps 🙂

    Plugin Support Darian

    (@d0153)

    Hi @maxm123

    Thank you for getting in touch and for sharing your findings

    I’ve created an internal ticket [TECTRIA-1586] to address this issue and I’ve included this thread in it to communicate it to our team.

    We prioritize bugs by taking into consideration the number of users impacted as well as how the bug impacts one’s ability to run an event/sell tickets. I don’t have a specific timeline as to when this issue will be resolved, but trust that our team is aware. Our team communicates updates and bug fixes in our newsletter and via our changelog.

    Thanks again for reporting this issue and for using The Events Calendar! Have a great day.

    Internal Bug Ticket Reference: TECTRIA-1586

    maxm123

    (@maxm123)

    Hi Darian,

    thank you for your reply! Have a good day 🙂

    Plugin Support Darian

    (@d0153)

    You’re very welcome, @maxm123

    Feel free to reach out anytime if you have other questions or concerns.

    Have a great day!

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.