Skip to main content

Drupal 8: How to create a custom ECK entity content programmaticaly

I am using the eck module for managing some custom entity types and their content. I have to create-import most of the custom eck content programmaticaly via api calls. This is how i create the custom sound eck entity type that belongs to the minute bundle of the sound entity (think of it as creating a new article of the node entity).

        $soundRecordData = [
          'type' => 'minute',
          'created' => $fromTimeRaw,
          'field_db' => $lMinEqASum,
        $soundEntity = \Drupal::entityTypeManager()->getStorage('sound')->create($soundRecordData);