Skip to content

Core Database Functions

dfdb()

/**
 * Global database function.
 *
 * @return Database
 * @throws ContainerExceptionInterface
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function dfdb(): Database;

get_object_subtype()

/**
 * Returns the object subtype for a given array ID of a specific type.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $type Type of array to request metadata for. (e.g. content, user, product).
 * @param string $id ID of the array to retrieve its subtype.
 * @return string The array subtype or an empty string if unspecified subtype.
 * @throws CommandPropertyNotFoundException
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws TypeException
 * @throws UnresolvableQueryHandlerException
 */
function get_object_subtype(string $type, string $id): string;

cms_slugify()

/**
 * Creates unique slug based on string.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $title Text to be slugified.
 * @param string $table Table the text is saved to (i.e. content, contenttype, site, product)
 * @return string Slug.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function cms_slugify(string $title, string $table): string;
/**
 * System function: Returns a list of content type links for TinyMCE.
 * 
 * @access private
 *
 * @file App/Shared/Helpers/db.php
 * @return object[]
 * @throws ReflectionException
 * @throws UnresolvableQueryHandlerException
 */
function tinymce_link_list(): array;

if_content_type_slug_exists()

/**
 * Checks if a slug exists among records from the content type table.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $contentTypeId Content Type id to check against.
 * @param string $slug Slug to search for.
 * @return bool Returns true if content type slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_content_type_slug_exists(string $contentTypeId, string $slug): bool;

if_content_slug_exists()

/**
 * Checks if a slug exists among records from the content table.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $contentId Content id to check against or null.
 * @param string $slug Slug to search for.
 * @param string $contentType The content type to filter.
 * @return bool Returns true if content slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_content_slug_exists(string $contentId, string $slug, string $contentType): bool;

if_site_slug_exists()

/**
 * Checks if a site slug exists.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $siteId Site id to check against.
 * @param string $slug Slug to search for.
 * @return bool Returns true if site slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_site_slug_exists(string $siteId, string $slug): bool;

if_product_slug_exists()

/**
 * Checks if a product slug exists.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $productId Product id to check against.
 * @param string $slug Slug to search for.
 * @return bool Returns true if site slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_product_slug_exists(string $productId, string $slug): bool;

is_content_parent()

/**
 * Checks if content has any children.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $contentId Content id to check.
 * @return bool|array| False if content has no children or array of children if true.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function is_content_parent(string $contentId): bool|array;

if_content_type_exists()

/**
 * Checks if a given content type exists on content.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $contentType Content Type slug to check for.
 * @return bool Returns true if content type exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_content_type_exists(string $contentType): bool;

reassign_content()

/**
 * System function: Reassigns content to a different user.
 * 
 * @access private
 *
 * @file App/Shared/Helpers/db.php
 * @param string $userId ID of user being removed.
 * @param string $assignId ID of user to whom content will be assigned.
 * @param string $contentId ID of the content.
 * @return bool
 * @throws CommandPropertyNotFoundException
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws SessionException
 * @throws TypeException
 * @throws CommandCouldNotBeHandledException
 * @throws UnresolvableCommandHandlerException
 */
function reassign_content(string $userId, string $assignId, string $contentId): bool;

reassign_sites()

/**
 * System function: Reassigns sites to a different user.
 * 
 * @access private
 *
 * @file App/Shared/Helpers/db.php
 * @param string $userId ID of user being removed.
 * @param array $params User parameters (assign_id and role).
 * @return bool
 * @throws CommandCouldNotBeHandledException
 * @throws CommandPropertyNotFoundException
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws SessionException
 * @throws TypeException
 * @throws UnresolvableCommandHandlerException
 */
function reassign_sites(string $userId, array $params = []): bool;

if_user_has_sites()

/**
 * Checks if the requested user is an admin of any sites or has any admin roles.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $userId ID of user to check.
 * @return bool Returns true if user has sites and false otherwise.
 * @throws CommandPropertyNotFoundException
 * @throws Exception
 * @throws ReflectionException
 * @throws TypeException
 * @throws UnresolvableQueryHandlerException
 * @throws ContainerExceptionInterface
 * @throws NotFoundExceptionInterface
 */
function if_user_has_sites(string $userId): bool;

get_owner_sites()

/**
 * Get an array of sites by owner.
 *
 * @file App/Shared/Helpers/db.php
 * @param string $userId The owner's id.
 * @return array
 * @throws CommandPropertyNotFoundException
 * @throws ReflectionException
 * @throws UnresolvableQueryHandlerException
 */
function get_owner_sites(string $userId): array;

populate_options_cache()

/**
 * System function: Populate the option cache.
 *
 * @access private
 * 
 * @file App/Shared/Helpers/db.php
 * @return bool
 * @throws ContainerExceptionInterface
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function populate_options_cache(): bool;

populate_usermeta_cache()

/**
 * System function: Populate the usermeta cache.
 *
 * @access private
 * 
 * @file App/Shared/Helpers/db.php
 * @return bool
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function populate_usermeta_cache(): bool;

populate_contentmeta_cache()

/**
 * System function: Populate the contentmeta cache.
 *
 * @access private
 *
 * @file App/Shared/Helpers/db.php
 * @return bool
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function populate_contentmeta_cache(): bool;

populate_productmeta_cache()

/**
 * System function: Populate the productmeta cache.
 *
 * @access private
 *
 * @file App/Shared/Helpers/db.php
 * @return bool
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function populate_productmeta_cache(): bool;

cms_nodeq_login_details()

/**
 * System function: Login Details Email.
 * 
 * @access private
 *
 * Function used to send login details to new
 * user.
 *
 * @file App/Shared/Helpers/db.php
 * @throws ContainerExceptionInterface
 * @throws EnvironmentIsBrokenException
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws SessionException
 */
function cms_nodeq_login_details(): void;

cms_nodeq_reset_password()

/**
 * System function: Reset Password Email.
 * 
 * @access private
 *
 * Function used to send reset password to a user.
 *
 * @file App/Shared/Helpers/db.php
 * @throws ContainerExceptionInterface
 * @throws EnvironmentIsBrokenException
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function cms_nodeq_reset_password(): void;