[Documentation](https://groundhogg.io/documentation/) » [Classes](https://groundhogg.io/documentation/#doc-classes)

# abstract \Groundhogg\Base_Object

Published Tuesday, June 9, 2026 · Last updated Tuesday, June 9, 2026

implements `Serializable`, `ArrayAccess`, `JsonSerializable`

The abstract foundation class for every Groundhogg data object. All objects — contacts, emails, funnels, tags, events, and more — extend this class. It handles creating, reading, updating, and deleting database records, as well as relationships between objects, notes, and serialisation.

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| `get_id()` | `int` | Returns the object’s primary key ID. |
| `exists()` | `bool` | Returns `true` if the record exists in the database. |
| `create( $data = [] )` | `static\|false` | Inserts a new record. Returns the object on success or `false` on failure. |
| `update( $data = [] )` | `bool` | Updates the database record with the given data. |
| `delete()` | `bool` | Deletes the record from the database. |
| `duplicate( $overrides = [] )` | `static\|false` | Creates a copy of the object with optional field overrides. |
| `merge( $other )` | `bool` | Merges another object of the same type into this one and deletes the other. |
| `pull()` | `bool` | Re-fetches the object’s data from the database, refreshing any cached values. |
| `get_data()` | `array` | Returns the raw database row as an associative array. |
| `get_as_array()` | `array` | Returns a serialisable representation of the object for use in REST responses or exports. |
| `admin_link()` | `string` | Returns the URL to this object’s edit screen in the WordPress admin. |
| `add_note( $note, $context = 'system', $user_id = false, $overrides = [] )` | `Note\|false` | Adds a note to this object. |
| `get_related_objects( $other_type = false, $is_parent = true )` | `array` | Returns related objects of a given type from the object relationships table. |
| `create_relationship( $other, $is_parent = true )` | `bool` | Creates a relationship between this object and another. |
| `delete_relationship( $other, $is_parent = true )` | `bool` | Removes a relationship between this object and another. |

## Usage

Here’s a pseudo code example for a hypothetical extension that works with any Groundhogg object.

```

<?php

// All Groundhogg objects share this interface
$contact = \Groundhogg\get_contactdata( 'jane@example.com' );
$email   = new \Groundhogg\Email( 42 );
$funnel  = new \Groundhogg\Funnel( 7 );

// Common Base_Object methods work on all of them
if ( $contact->exists() ) {
    $contact->update( [ 'first_name' => 'Jane' ] );
    $contact->add_note( 'Updated via my plugin.' );
}

// Create a relationship between a contact and a campaign
$campaign = new \Groundhogg\Campaign( 3 );
$contact->create_relationship( $campaign );

// Duplicate an email template
$copy = $email->duplicate( [ 'title' => 'Copy of ' . $email->get_title() ] );
```
