GatoGraphQL / GatoGraphQL

Interact with all your data in WordPress using GraphQL

Home Page:https://gatographql.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `setImplementedComponentClasses` to specify that a Component satisfies the contracts for another Component

leoloso opened this issue · comments

If an extension depends on a 3rd party library, and the library is not installed/active in the site, we may get an error:

PHP Fatal error:  Uncaught Exception: The following names have not been implemented by the CMS: "popcomponent:locations:dbcolumn:orderby:locations:name", "popcomponent:events:dbcolumn:orderby:events:startdate". Hence, we can't continue.

To fix it, the Component with the contracts must implement resolveEnabled asking if hasImplementerComponent is true. If false, the package must not be loaded.

Eg: events depends on events-wp-em which depends on events-manager. Then:

  • EventsWPEM\Component is loaded only if the events-manager plugin is loaded
  • EventsWPEM\Component must indicate it satisfies Events\Component
  • If satisfied, Events\Component is loaded, otherwise it is not.