UseMuffin/Webservice

Empty custom Endpoint class is required to use non-generic Resource

asgraf opened this issue · 1 comments

asgraf commented

What i did:

  1. Created /PayPalApi/src/Webservice/PayPalProductsWebservice.php
  2. Created /PayPalApi/src/Model/Endpoint/Schema/PayPalProductSchema.php
  3. Created /PayPalApi/src/Model/Resource/PayPalProduct.php
  4. and test code below:
$expectedClass = \get_class(FactoryLocator::get('Endpoint')->get('PayPalApi.PayPalProducts')->newEmptyEntity())
debug($expectedClass);

What i got:
Muffin\Webservice\Model\Resource

What i expected:
PayPalApi\Model\Resource\PayPalProduct

Work around:
Creating /PayPalApi/src/Model/Endpoint/PayPalProductsEndpoint.php with empty class that extends \Muffin\Webservice\Model\Endpoint changes code result to expected one

PayPalProduct class should be used without requirement of creating empty custom PayPalProductsEndpoint class

ADmad commented

Similar to the core ORM, if you want to use a custom entity class then you must create a custom model class. Too much magic leads to hidden errors.