Hi,

is the payment_reference field production ready ? Because after adding a payment_reference field to my content type it is showing error when i proceed to create the node
i am using drupal-8.3.1 with payment 8.x-2.0-rc3

Uncaught PHP Exception InvalidArgumentException: "Value is not a valid entity." at core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php line 106,

CommentFileSizeAuthor
#3 payment_2874885_1.patch932 bytesbiswajeetparida

Comments

biswajeetparida created an issue. See original summary.

biswajeetparida’s picture

Issue summary: View changes
biswajeetparida’s picture

StatusFileSize
new932 bytes

This solve my issue

Anonymous’s picture

Does this actually work?

While the PHP error is gone, the payment reference target_id returned seems to be 0, which is not helpful either.

Is the problem that the payment is not saved, so we have no payment id?

This actually seems to return an array:

array (
  'container' => 
  array (
    'payment_form' => 
    array (
      'payment_method' => 
      array (
        'container' => 
        array (
          'select' => 
          array (
            'container' => 
            array (
              'plugin_id' => 'payment_basic:cheque',
            ),
          ),
        ),
      ),
    ),
  ),
)

So how would I actually get to the value of the saved payment?

I seem to be able to get the right target_id from:

$form_state->getStorage()['payment_reference.element.payment_reference.payment']->id();

berdir’s picture

Version: 8.x-2.0-rc3 » 8.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

Doesn't seem to happen in tests, maybe something about nested form elements or so? Would need steps to reproduce on a clean site.