mDIS Behaviors Catalog
mDIS Behaviors Catalog
See also: Behaviors – Detailed Visual Guide — for screenshots and parameter details of each behavior.
See also: Behaviors Used – Pivot Table — for a cross tabulation of which behaviors are assigned to which models by default.
This document catalogs most Yii behaviors implemented in mDIS, with a brief description and usage notes for each. For general Yii2 behavior documentation, see the Yii2 Guide.
Template Behaviors (Configurable via Template Manager GUI)
Note:Template Behaviors are assignable and configurable via the mDIS Template Manager GUI. These behaviors appear in the "ADD" button dropdown in the Model Designer and can be parameterized through the GUI.
See detailed visual guide for screenshots and parameter details of each behavior. Most implementTemplateManagerBehaviorInterface
for integration with the Template Manager. See the source code inbackend/behaviors/template/
.
System Behaviors (Developer-Only)
Not configurable via Template Manager GUI.
Note: System Behaviors are essential behaviors that are not assignable or configurable via the mDIS Template Manager GUI. Historically, these were implemented for use by developers directly in the PHP codebase. They are typically attached automatically or by developers in code, and are not visible in the Template Manager's "ADD" button dropdown. The ability to assign behaviors via the GUI was added later as an enhancement, and only a subset of behaviors (see below) are available there.
Unique Combination Auto Increment
- Deprecated: use the configurable Template-Behavior variant of ' Unique Combination Auto Increment' instead.
- Fills a local auto-increment column with a unique value within a group (e.g., section numbers within a core).
Class:UniqueCombinationAutoIncrementBehavior
Filename:backend/behaviors/UniqueCombinationAutoIncrementBehavior.php
Parameters:searchFields
,fieldToFill
JsonFieldBehavior
- Class:
JsonFieldBehavior
- Filename:
backend/behaviors/JsonFieldBehavior.php
- Automatically converts specified attributes from JSON string to array and back.
- Parameters:
fields
,jsonOptions
,defaultValue
,skipEmpty
,asArray
Section Split: Fix Corebox Status when section is used up after sampling
- Class:
CurationSectionSplitCoreboxBehavior
- Filename:
backend/behaviors/CurationSectionSplitCoreboxBehavior.php
- Removes corebox-related fields when
still_exists
is set to false. - Parameters:
coreboxColumns
,stillExistsColumn
Update drilling top depth
- Class:
UpdateDrillingTopDepthBehavior
- Filename:
backend/behaviors/UpdateDrillingTopDepthBehavior.php
- When
drillers_top_depth
changes, recalculates values for following cores in the same hole. - Parameter:
ATTRIBUTE_NAME
Additional System Behaviors (Not Configurable via GUI)
The following behaviors are present in the codebase but are not exposed for configuration in the Template Manager. They are typically attached automatically or by developers in code.
CombinedId4ArchiveFileBehavior
- Class:
CombinedId4ArchiveFileBehavior
- Filename:
backend/behaviors/CombinedId4ArchiveFileBehavior.php
- Description: Automatically generates a combined, human-readable ID for archive file records, similar to
CombinedIdBehavior
but specialized for the ArchiveFile model. This helps maintain consistent, traceable IDs for files linked to geological data. - Configuration: Not configurable via GUI. Used internally by the ArchiveFile model.
CuratorBehavior
- Class:
CuratorBehavior
- Filename:
backend/behaviors/CuratorBehavior.php
- Description: Handles logic related to curator assignment and tracking for records. This may include automatically setting or updating curator fields based on user actions or workflow events.
- Configuration: Not configurable via GUI. Typically attached in code where curator logic is required.
SampleMaxBottomBehavior
- Class:
SampleMaxBottomBehavior
- Filename:
backend/behaviors/SampleMaxBottomBehavior.php
- Description: Ensures that the "bottom" value of a sample does not exceed certain constraints, such as the maximum allowed depth or length within a parent section or split. Used to enforce data integrity for sample intervals.
- Configuration: Not configurable via GUI. Used internally for sample validation.
UpdateStorageCombinedIdBehavior
- Class:
UpdateStorageCombinedIdBehavior
- Filename:
backend/behaviors/UpdateStorageCombinedIdBehavior.php
- Description: Updates the
combined_id
field for storage-related records when relevant fields change. Ensures that storage IDs remain consistent and reflect the current state of the record. - Configuration: Not configurable via GUI. Used internally for storage management.
UpdateSubSampleRequestBehavior
- Class:
UpdateSubSampleRequestBehavior
- Filename:
backend/behaviors/UpdateSubSampleRequestBehavior.php
- Description: Handles updates to sub-sample request records, such as propagating changes or recalculating fields when a parent sample or request is modified. Supports workflow automation for sample requests.
- Configuration: Not configurable via GUI. Used internally for sub-sample request logic.
Default from Parent
- Class:
DefaultFromParentBehavior
- Filename:
backend/behaviors/template/DefaultFromParentBehavior.php
- Copies a value from a parent record to a child record.
- Parameters:
parentSourceColumn
,destinationColumn
Default from Sibling
- Class:
DefaultFromSiblingBehavior
- Filename:
backend/behaviors/template/DefaultFromSiblingBehavior.php
- Copies a value from the last sibling record to the new record.
- Parameters:
parentRefColumn
,sourceColumn
,destinationColumn
Siblings Limit
- Class:
SiblingsLimitBehavior
- Filename:
backend/behaviors/template/SiblingsLimitBehavior.php
- Limits the number of records with the same parent reference value.
- Parameters:
parentRefColumn
,limit
(integer or callback)
Leading Zeros
- Class:
LeadingZerosBehavior
- Filename:
backend/behaviors/template/LeadingZerosBehavior.php
- Pads numeric string values with leading zeros to a fixed length for sorting.
- Parameters:
column
,length
Splittable Section
- Class:
SplittableSectionBehavior
- Filename:
backend/behaviors/template/SplittableSectionBehavior.php
- Automatically creates a default split record when a section is inserted.
- Parameter:
splitsModel
Validate Origin Split Type
- Class:
ValidateSplitOriginTypeBehavior
- Filename:
backend/behaviors/template/ValidateSplitOriginTypeBehavior.php
- Validates the origin split type in section split records.
- No parameters; only for
CurationSectionSplit
class.
Cumulative Section Length
- Class:
CumulativeSectionLengthBehavior
- Filename:
backend/behaviors/template/CumulativeSectionLengthBehavior.php
- Validates that the cumulative length of sections matches constraints relative to core recovery.
- Parameters:
minRelativeLength
,maxRelativeLength
Other Template Behaviors
DefaultFromOtherColumnBehavior
: Copies value from another column.SiblingsLimitFromParentBehavior
: Limits siblings based on parent.SampleFractionTakenBehavior
: Tracks sample fractions.
Create or update core box
CreateUpdateCoreboxBehavior
: Handles corebox creation/update.- Parameters:
coreboxNameColumn
,coreboxIdColumn
- Parameters:
TemplateManagerBehaviorInterface
: Interface for template behaviors.
Usage Notes
- Behaviors are attached via the
behaviors()
method in model classes. - Most template behaviors implement
TemplateManagerBehaviorInterface
for integration with the mDIS Template Manager. - See the source code in
backend/behaviors/
andbackend/behaviors/template/
for details and parameters.
References
- Yii2 Behaviors Guide
- Yii2 API: yii\base\Behavior
- mDIS developer documentation