Firebrand\Hail\Models\ApiObject
Abstract representation of an Hail Api object.
Will never be used directly apart from the static methods
- Author: Maxime Rainville, Firebrand
Synopsis
class ApiObject
extends DataObject
{
- // members
- public static array $fetchables = ;
- public static $object_endpoint;
- public static array $object_parameters = ;
- protected static $api_map;
- private static string $organisations_endpoint = "organisations";
- private static string $table_name = "HailApiObject";
- private static boolean $api_access = false;
- private static array $indexes = ;
- private static array $db = ;
- private static array $summary_fields = ;
- private static array $has_one = ;
- // methods
- public void getCMSFields()
- public boolean isOutdated()
- public static boolean isFetchable()
- public ApiObject refresh()
- protected boolean importHailData()
- protected void importing()
- protected boolean excluded()
- public static void fetchForOrg()
- public static void fetchAll()
- public void canView()
- public void canDelete()
- public void canCreate()
- public void canEdit()
- protected void makeRecordViewer()
- protected void processPublicTags()
- protected void processPrivateTags()
- protected void processHeroImage()
- protected void processHeroVideo()
- protected void processAttachments()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Members
private
- $api_access
- $db
- $has_one
- $indexes
- $organisations_endpoint
—
string
Hail Organisation endpoint - $summary_fields
- $table_name
protected
- $api_map
—
array
Map the fields returned by the Hail API with the SilverStripe DB Fields
public
- $fetchables
—
array
List of all the subclasses of Hail ApiObject that can be fetched from Hail - $object_endpoint
—
string
Hail API endpoint name for this object - $object_parameters
—
string
Hail API extra endpoint parameters to be passed with every request
Methods
protected
- excluded() — Determine if this object is to be excluded based on the provided data (public and private tags).
- importHailData() — Process the json data from Hail API and writes to SS db
- importing() — Is called by {@link importHailData()} to allow children classes to perform additional data assignment
- makeRecordViewer() — Helper function to add a ReadOnly gridfield for a relation
- processAttachments() — Go through the attachments and assign them to this object.
- processHeroImage() — Match the hero image if there's one and assign it to this object
- processHeroVideo() — Match the hero video if there's one and assign it to this object
- processPrivateTags() — Go through the list of private tags and assign them to this object.
- processPublicTags() — Go through the list of public tags and assign them to this object.
public
- canCreate() — Create permission
- canDelete() — Delete permission
- canEdit() — Edit permission
- canView() — View permission
- fetchAll() — Fetch from Hail API for all configured organisations
- fetchForOrg() — Fetch from Hail API for a specified Organisation
- getCMSFields()
- isFetchable() — Determines if the object is fetchable
- isOutdated() — Determines if the object is outdated
- refresh() — Retrieves the latest version of this object from the Hail API