Class $k.InstanceType

Represents a type of instances

Class Summary
Constructor Attributes Constructor Name and Description
 

Method Summary

Class Detail

$k.InstanceType()

Method Detail

  • {$k.Instance[]} allInstances()
    Returns all instances of this type and all subtypes. Avoid using this function if possible, use queries instead
    Returns:
    {$k.Instance[]}
  • {$k.Instance} createInstance(param, language)
    Create a new instance of this type
    Parameters:
    {string} param Optional
    The name of the new instance
    {string} language Optional
    Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
    Throws:
    {$k.exception.SchemaError}
    If the type is abstract
    {$k.exception.AccessDenied}
    If creating an instance is not allowed
    {$k.exception.TransactionError}
    If no write transaction is active
    Returns:
    {$k.Instance} The created instance
  • {$k.Type} createSubtype(param, language)
    Create a new subtype
    Parameters:
    {string} param Optional
    The name of the new type
    {string} language Optional
    Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
    Throws:
    {$k.exception.SchemaError}
    If subtypes cannot be created
    {$k.exception.AccessDenied}
    If creating a subtype is not allowed
    {$k.exception.TransactionError}
    If no write transaction is active
    Returns:
    {$k.Type} The created type
  • {$k.InstanceType[]} extendedTypes()
    Returns the types that can be extended by this type or a subtype. Does not check if this type allows to create extensions
    Returns:
    {$k.InstanceType[]}
    See:
    $k.Type#canCreateExtensions
  • {$k.InstanceType[]} extensionTypes()
    Returns the types that can extend instances of this type. Does not check if these types allow to create extensions
    Returns:
    {$k.InstanceType[]}
    See:
    $k.Type#canCreateExtensions
  • {$k.Instance[]} instances()
    Returns all direct instances of this type. Avoid using this function if possible, use queries instead
    Returns:
    {$k.Instance[]}