8 – RESTful Web Services: How to easily publish a sales entity

I simply activated the standard sales resource with the core module (8.8.3):
Basic configuration

I want to post a paragraph, but even with the "Type" field, I received 403 errors as an answer! I have almost the same request that works well for nodes …

        var newReleve = {

          type: ({
            target_id: 'releve_de_chantier'
          }),
          parent_id: ({
            value: this.nid,
          }),
          parent_type: ({
            value: 'projet',
          }),
          // field_type_de_releve_de_chantier: (
          //   {
          //     value: this.typeReleve
          //   }
          // ),

        };

        if(this.pid) {
          newReleve.id = ({
            value: this.pid
          })
        }


        fetch('/entity/paragraph'+(this.pid ? '/'+this.pid : '')+'?_format=json', {
          method: this.pid ? 'PATCH' : 'POST',
          headers: {
            'Content-Type': 'application/json',
            'X-CSRF-Token': csrfToken
          },
          body: JSON.stringify(newReleve)})
          .then(response => {
            if(response.ok){
              return response.json();
            } else {
              console.log(response);
              throw('Error posting datas ! Details below n ' + response.status + ' : ' + response.statusText);
            }
          })
          .then(para => {
            // console.log(para);
            this.pid = para.id(0).value;
            console.log(this.pid);

          })
          .catch( error => {
            alert('Enregistrement du relevé non effectué : erreur interne du programme ! Détail de l'erreur : n ' + (error.message ? error.message : error) );
            console.error(error);
          });

Any idea ?

Thanks a lot

entity – "EntityMetadataWrapperException: Invalid data value specified. Make sure that it matches the required data type and format for the date field."

I'm working on creating a calendar event, so I've created a custom event storage module for a custom content type. I installed the entity and date modules and created a date field (partner_event_date) that accepts values ​​from and up to the date.

In my custom module I use the following code.

$wrapper->field_partner_event_date->set(array(
  'value' => date('Y-m-d H:i:s',$dateFrom),
  'value2' => date('Y-m-d H:i:s', $dateTo),
));

The following output is displayed at the top of the screen.

array(
  'value' => '2022-02-05 00:00:00',
  'value2' => '2024-07-03 00:00:00',
)

The error I get is the following.

EntityMetadataWrapperException: Invalid data value specified. Make sure it matches the required data type and format. Value at node () -> field_partner_event_date:. in EntityMetadataWrapper-> set () (line 122 of /sites/all/modules/entity/includes/entity.wrapper.inc).

I installed my module on a new Drupal installation. It works fine while the client site (which has already been created) displays this error message during installation and configuration. Can anyone help?

entity – EntityMetadataWrapperException: Invalid data value specified. Make sure it matches the required data type and format for the date field in Drupal 7

I'm working on creating a calendar event, so I've created a custom event storage module for a custom content type. I have already installed the entity module and the date module.
I have a date field & # 39; partner_event_date & # 39; created that accepts dates from and to.

In my custom module, I wrap the date field values ​​as follows:

$ wrapper-> field_partner_event_date-> set (array (
& # 39; value & # 39; => Date (& # 39; Y-m-d H: i: s & # 39 ;, $ dateFrom),
& # 39; value2 & # 39; => Date (& # 39; Y-m-d H: i: s & # 39 ;, $ dateTo),
));

And an output is shown at the top of the screen:
Array (& # 39; Value & # 39; => & # 39; 2022-02-05 00: 00: 00 & # 39 ;, & # 39; Value2 & # 39; => & # 39; 2024-07-03 00 : 00: 00 & # 39 ;,)

The error I get is:
EntityMetadataWrapperException: Invalid data value specified. Make sure it matches the required data type and format. Value at node () -> field_partner_event_date:. in EntityMetadataWrapper-> set () (line 122 of /sites/all/modules/entity/includes/entity.wrapper.inc).

I installed my module on a new Drupal installation, it works perfectly there, but on the client site (which was already created) when I installed and configured it, these errors are displayed. Can somebody help me with it.

magento2.3.4 – No such entity with orderId =

For the past few days I have had a strange problem with my Magento 2.3.4 site (it's a new installation and is hosted on a web server). Whenever I try to make a transaction by making a payment (in test mode) by credit card through a payment gateway – my order fails and I get the error of such an entity with the order number =
I recently noticed this problem after integrating it into Paypal Express Checkout. I had previously had several successful tests with the same payment gateway without any problems.
I have checked the logs at the end of the payment gateway and all my transactions are successfully recorded with an order ID (!), But the same is not shown in the frontend (see 2nd screenshot).

I tried to complete the cash on delivery transaction and my order is generated with no problems.
I did a debug traceback after reviewing the previous posts and got the following results (although I haven't done the head or number of them yet, please refer to the traceback screenshot

I also checked the debug report in the var / logs / debug.log file and found several bad references. While I fixed some (like reinstalling yotpo after noticing yotpo-bottomline tried to reorder towards product.info.addto, removing some extensions like ves_imageslider etc.).
However, there are a large number of broken references that I cannot fix because they are Magento (??) issues (or is it my postage issue).


(2020-04-02 16:11:50) main.INFO: Incorrect reference: The & # 39; Tracking & # 39; element cannot be used as a subordinate element to the & # 39; Header # must be added since the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Incorrect reference: The element & # 39; global_notices & # 39; cannot be a child of & # 39; global.notices & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The element & # 39; logo & # 39; cannot be a child of the & # 39; header & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; global.search & # 39; cannot be a child of the & # 39; header & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; user & # 39; cannot be a child of & # 39; header & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; menu & # 39; cannot be a child of & # 39; page.menu & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; bread crumbs & # 39; can't be a child of & # 39; page.breadcrumbs & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; formkey & # 39; cannot be a child of & # 39; page.formkey & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The element & # 39; page.title & # 39; cannot be a child of & # 39; main.top & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; messages & # 39; cannot be a child of & # 39; page.messages & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; page.actions.toolbar & # 39; cannot be a child of & # 39; page.main.actions & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The element & # 39; legal & # 39; cannot be added to the footer as a child because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; notification_area & # 39; cannot be a child of & # 39; Notifications & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; unread_system_messages & # 39; cannot be a child of & # 39; notifications & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; notification_window & # 39; cannot be a child of & # 39; Notifications & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The element & # 39; notification.messages & # 39; cannot be a child of the & # 39; header & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Incorrect reference: The element & # 39; header.inner.left & # 39; cannot be a child of & # 39; header & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: broken link: the element & # 39; header.inner.right & # 39; cannot be a child of & # 39; header & # 39; be added because the latter does not exist () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; logo & # 39; tries to move towards & # 39; & # 39; rearrange, but their parents are different: & # 39; Header & # 39; or & # 39; & # 39 ;. () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; global.search & # 39; tries to move towards & # 39; logo & # 39; rearrange, but their parents are different: & # 39; header & # 39; or & # 39; & # 39 ;. () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; user & # 39; tries to move towards & # 39; & # 39; rearrange, but his parents are different: & # 39; Header & # 39; or & # 39; & # 39 ;. () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; page.actions.toolbar & # 39; tries to move towards & # 39; & # 39; rearrange, but their parents are different: & # 39; page.main.actions & # 39; and & # 39; & # 39; respectively. () ()
(2020-04-02 16:11:50) main.INFO: Broken reference: The & # 39; notification.messages & # 39; tries to move towards & # 39; user & # 39; rearrange, but their parents are different: & # 39; header & # 39; or & # 39; & # 39 ;. () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; header.inner.left & # 39; tries to move towards & # 39; & # 39; rearrange, but their parents are different: & # 39; header & # 39; or & # 39; & # 39 ;. () ()
(2020-04-02 16:11:50) main.INFO: Broken link: The & # 39; header.inner.right & # 39; tries to head towards & # 39; header.inner.left & # 39; rearrange, but their parents are different: & # 39; header & # 39; and & # 39; & # 39; respectively. () ()

Any insights to fix it would be greatly appreciated.

thanks greetings,
Harish

(The mistake
(The payment gateway is displayed
(Debug traceback sceenshot

Entity Framework – The difference between ORM and stored procedures

When developing my web application, I was asked the following question: What would be the difference between using EF, ADO.net with Linq, or stored procedures in CRUD methods? Apart from the differences in performance that I would like to test myself, I am curious to see what scenarios people choose from each other. Is it a matter of context or just personal preference?

In addition, after doing some research, I read that some ORMs use stored procedures. It is not entirely clear to me which ones do this and how it works. Is it also better to use an ORM with stored procedures?

Therefore, I ask for help comparing ORM frameworks and stored procedures, both conceptually and in terms of usability.

EDIT: I appreciate any feedback, be it positive or negative. But if you have the time to read and vote on this post, you can also help a newbie with advice on what he did wrong.

C # – Does Entity Framework Core 3 support MySQL or MariaDb?

Regards I have been investigating whether it is possible to use a MySQL database with the Entity Framework core, and so far I have found that I can use a package called "grapefruit". In the MySQL documentation it is only supported up to version (2.1) of net core and checking the Microsoft documentation does not seem to me to be a compatible provider, mysql only SQL Server and Sqlite Microsoft documentation

Unity – Small health bar above the entity is drawn differently if the entity is rotated differently

Here is a simple positioning code for my health ad:

transform.position = Camera.main.WorldToScreenPoint(target.position - 0.2f * target.up);

Here is the prefabricated house:

Enter the image description here

  • HealthBar is anchored in the center of the center and swivels 0.5, 0.5.
  • The background and fill are stretched and panned 0.5, 0.5, but the background is positioned on the left, right, top, bottom -1.

It should look like this: (All pictures are enlarged)

Enter the image description here

And here is a video about the entity that is spinning: https://i.imgur.com/EOzFEvt.mp4

2 example rotations where the health bar is drawn incorrectly:

Enter the image description here

Enter the image description here

Why?

8 – Fill in an entity reference field (media image) in advance when creating a node

I'm trying to open a node creation form (e.g. /node/add/article) and to pre-populate an entity reference field.

My field (field_image) is a Entity reference to a media of type image and the form uses the Media library widget.

I essentially tried to do this through implementation hook_form_alter in a custom module, but nothing I tried worked. I've seen solutions like this. It works with other field types that I have tried. For example:

// Pre-populate Entity Reference field to taxonomy term

$term = Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(13);
$form('field_category')('widget')(0)('target_id')('#default_value') = $term;

The above works well. But not the following.

// Pre-populate Entity Reference field to Media Image

$media = Drupal::entityTypeManager()->getStorage('media')->load(38);
$form('field_image')('widget')(0)('target_id')('#default_value') = $media;

I also tried just specifying the media ID instead of the entity, but it didn't work.

I also tried the Prepopulate module, but I couldn't get it to work, even though it works with all the other field types I've tried.

Does anyone know if and how this is possible?

Edit: I should perhaps mention that I am not looking for a solution on how to set a default value for this field. The referenced entity must be set dynamically

For reference, here is my full code:

/**
 * Implements hook_form_alter().
 */
function siteconfig_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  if ($form_id == 'node_article_form') {

    // This works
    $term = Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(13);
    $form('field_category')('widget')(0)('target_id')('#default_value') = $term;

    // This doesn't work
    $media = Drupal::entityTypeManager()->getStorage('media')->load(38);
    $form('field_image')('widget')(0)('target_id')('#default_value') = $media;
  }
}