Document how to create ECK objects programmatically

Created on 19 June 2024, 10 months ago

It would be very useful to document how to create ECK objects programmatically with v2.

πŸ“Œ Task
Status

Active

Version

2.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @DamienMcKenna
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    This structure is a starting point.

    use Drupal\eck\Entity\EckEntity;
    
    $organization = EckEntity::create([
      'entity_type' => $eck_entity_type,
      'type' => $eck_entity_bundle,
    ]);
    $organization->setOwner($account);
    $organization->set('title', $the_title);
    $organization->set('field_some_string', $something);
    $organization->save();
    
Production build 0.71.5 2024