eZ Community » Forums » eZ Publish 5 Platform » Gateway based storage & custom datatype
expandshrink

Gateway based storage & custom datatype

Gateway based storage & custom datatype

Friday 25 April 2014 2:19:29 pm - 1 reply

Hello,

I've created a custom datatype which uses a custom sql table with eZ Persistent Object. It's working great on Back-end, however how can I fetch the data stored on this custom table on Front-End (eZ 5.2)?

I created a Gateway class and follow these instructions: https://confluence.ez.no/display/EZP/Register+FieldType#RegisterFieldType-Gatewaybased

However I cannot make it work, is there any complete example of this? Is this the best way to do this?

Thanks

Tuesday 29 April 2014 2:46:32 pm

Hi.

You can find examples of FieldTypes with external storage (always gateway based) in the kernel: Keyword, Image, BinaryFile, Media, Url... the easiest are probably Keyword and Url.

You overall need:

  • to implement GatewayBasedStorage, like UrlStorage does
  • to register your gateway as a service, as in fieldtypes.yml, using its identifier (here ezurl) as an alias
  • to implement the LegacyStorage Gateway, as in UrlStorage\Gateway\LegacyStorage
  • to register your gateway as a service, tagged as ezpublish.fieldType.externalStorageHandler.gateway, with the fieldtype's identifier as "alias", and LegacyStorage as "identifier", as in storage_engines.yml
  • Optional: your LegacyStorage Gateway should ideally implement a custom interface, like UrlStorage\Gateway, that defines the API for your gateway. It isn't mandatory, but it is cleaner since you can typehint on the interface, and will make it easier to implement custom storage for future storage engines

We will cover external storage in a future tutorial, but I hope this will help you unblock your work.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from