PageCustomAssetAssignmentTrait
Hook that gives a new page the snippets flagged `add_to_new_pages = 1`.
The logic lives here so it can be tested without DB, DI or network
(PageCustomAssetAssignmentTraitTest); the real INSERT IGNORE
is a raw DBAL seam implemented by PageManager.
Called from two places in PageManager, both inside the page insert transaction:
The assignment is idempotent (INSERT IGNORE), so a repeated call for the same page
is harmless.
Table of Contents
Methods
- assignCustomAssetsToNewPage() : int
- Assigns all snippets flagged `add_to_new_pages = 1` to the new page `$pageId`.
- attachNewPageCustomAssetRows() : int
- Links snippets flagged `add_to_new_pages = 1` to page `$pageId` (`INSERT IGNORE`) and returns the number of new links.
Methods
assignCustomAssetsToNewPage()
Assigns all snippets flagged `add_to_new_pages = 1` to the new page `$pageId`.
public
assignCustomAssetsToNewPage(int $pageId) : int
A thin wrapper over the seam; it exists as the single call site and contract documentation.
Parameters
- $pageId : int
Return values
intattachNewPageCustomAssetRows()
Links snippets flagged `add_to_new_pages = 1` to page `$pageId` (`INSERT IGNORE`) and returns the number of new links.
protected
abstract attachNewPageCustomAssetRows(int $pageId) : int
Parameters
- $pageId : int