Occurrence::find_by_post_id( int $id )
Finds the Occurrence model instance, if any, for a real post ID, a provisional post ID, or an Occurrence ID.
Contents
Parameters
- $id
-
(int) (Required) The ID to return an Occurrence instance for. Either a real Event Post ID, a provisional Occurrence ID.
Return
(TECEventsCustom_TablesV1ModelsOccurrence|null) A reference to the matching Occurrence instance, or null if no Occurrence instance could be matched to the ID.
Source
File: src/Events/Custom_Tables/V1/Models/Occurrence.php
public static function find_by_post_id( $id ) {
if ( empty( $id ) ) {
return null;
}
$id = self::normalize_id( $id );
return static::find( $id, 'post_id' );
}