Entity

Entity

new Entity()

Properties:
Name Type Description
name string The entity name
type string The entity type
table string The entity table
plural string The entity plural name
top string The top position on the Vemto Schema
left string The left position on the Vemto Schema
pivot boolean If this entity is a pivot table
softDeletes boolean It has enabled the softDeletes
timestamps boolean It has enabled the timestamps
pluralAndSingularAreSame boolean Determine if the entity name is the same in plural and singular cases
cruds Array.<Crud> All cruds of this Entity
project Project The Vemto project
fields Array.<Field> All fields of this Entity
foreigns Array.<Foreign> All foreigns of this Entity
pivotMorphRelationships Array.<MorphRelationship> All pivot morph relationships of this Entity
basicRelationships Array.<BasicRelationship> All basic relationships of this Entity
basicRelatedRelationships Array.<BasicRelationship> All basic related relationships of this Entity
morphRelationships Array.<MorphRelationship> All morph relationships of this Entity
morphRelatedRelationships Array.<MorphRelationship> All morph related relationships of this Entity
pivotRelationships Array.<ManyToManyRelationship> All pivot relationships of this Entity
manyToManyRelationships Array.<ManyToManyRelationship> All many to many relationships of this Entitty
manyToManyRelatedRelationships Array.<ManyToManyRelationship> All many to many related relationships of this Entity

Members

leftPosition

Get the entity top position on Vemto Schema

topPosition

Get the entity top position on Vemto Schema

Methods

belongsToAnotherEntity(entity) → {boolean}

Check if the entity has the belongsTo relationship with another entity
Parameters:
Name Type Description
entity Entity
Returns:
Type
boolean

dateFields() → {Array.<Field>}

Returns date fields
Returns:
Type
Array.<Field>

fillableFields() → {Array.<Field>}

Returns fillable fields
Returns:
Type
Array.<Field>

fillableFieldsWithoutInputs() → {Array.<Field>}

Returns fillable fields that have no inputs
Returns:
Type
Array.<Field>

foreignFields() → {Array.<Field>}

Returns foreign fields
Returns:
Type
Array.<Field>

getAllMorphRelationships() → {Array.<MorphRelationship>}

Returns all morph relationships
Returns:
Type
Array.<MorphRelationship>

getAllRelationships() → {Array.<Relationship>}

Returns all basic and manyToMany relationships
Returns:
Type
Array.<Relationship>

getBasicMorphInverseRelationships() → {array}

Returns the morph inverse relationships
Returns:
Type
array

getBasicMorphRelatedRelationships() → {Array.<MorphRelationship>}

Returns all basic morph of related relationships
Returns:
Type
Array.<MorphRelationship>

getBasicMorphRelationships() → {Array.<MorphRelationship>}

Returns all basic morph relationships
Returns:
Type
Array.<MorphRelationship>

getBelongsToManyRelationships() → {Array.<ManyToManyRelationship>}

Returns all belongsToMany relationships
Returns:
Type
Array.<ManyToManyRelationship>

getBelongsToRelationships() → {Array.<BasicRelationship>}

Returns all belongsTo relationships
Returns:
Type
Array.<BasicRelationship>

getControllerName() → {string}

Returns the controller name
Returns:
Type
string

getFieldByName(fieldName) → {Field|undefined}

Returns the field by name
Parameters:
Name Type Description
fieldName string
Returns:
Type
Field | undefined

getHasManyRelationships() → {Array.<BasicRelationship>}

Returns all hasMany relationships
Returns:
Type
Array.<BasicRelationship>

getHasOneRelationships() → {Array.<BasicRelationship>}

Returns all hasOne relationships
Returns:
Type
Array.<BasicRelationship>

getLabelField() → {string}

Returns the label field - this field represents the model (eg: name, title, id, etc), an can be used on select inputs
Returns:
Type
string

getLabelFieldName() → {string|null}

Returns the label field name - this field represents the model (eg: name, title, id, etc), an can be used on select inputs
Returns:
Type
string | null

getManyToManyMorphRelatedRelationships() → {Array.<MorphRelationship>}

Returns all manyToManyMorph of related morph relationships
Returns:
Type
Array.<MorphRelationship>

getManyToManyMorphRelationships() → {Array.<MorphRelationship>}

Returns all manyToManyMorph of morph relationships
Returns:
Type
Array.<MorphRelationship>

getPkName() → {string}

Returns the primary key name (sugar syntax)
Returns:
Type
string

getPrimaryKey() → {Field|undefined}

Returns the primary key
Returns:
Type
Field | undefined

getPrimaryKeyName() → {string}

Returns the primary key name
Returns:
Type
string

getSelfRelationships() → {array}

Get all self-relationships
Returns:
Type
array

getSelfRelationshipsForeigns() → {array}

Get foreign keys from self-relationships
Returns:
Type
array

getSelfRelationshipsForeignsNames() → {array}

Get foreign keys names from self-relationships
Returns:
Type
array

guardedFields() → {Array.<Field>}

Returns guarded fields
Returns:
Type
Array.<Field>

hasCastFields() → {boolean}

Check if it has cast fields
Returns:
Type
boolean

hasDateFields() → {boolean}

Check if it has date fields
Returns:
Type
boolean

hasFieldByName() → {Field|undefined}

Check if it has fields by name
Returns:
Type
Field | undefined

hasFieldWithSameName(field) → {boolean}

Check if it has others fields with the same name
Parameters:
Name Type Description
field Field
Returns:
Type
boolean

hasFillableFields() → {boolean}

Check if it has fillable fields
Returns:
Type
boolean

hasForeigns() → {boolean}

Check if it has foreign fields
Returns:
Type
boolean

hasHiddenFields() → {boolean}

Check if it has hidden fields
Returns:
Type
boolean

hasIndexFields() → {boolean}

Check if it has index fields
Returns:
Type
boolean

hasJsonFields() → {boolean}

Check if it has JSON fields
Returns:
Type
boolean

hasManyOfAnotherEntity(entity) → {boolean}

Check if the entity has the hasMany relationship with another entity
Parameters:
Name Type Description
entity Entity
Returns:
Type
boolean

hasSimilarRelationship(field) → {boolean}

Check if it has a similar relationship
Parameters:
Name Type Description
field Field
Returns:
Type
boolean

hasUniqueFields() → {boolean}

Check if it has unique fields
Returns:
Type
boolean

hiddenFields() → {Array.<Field>}

Returns hidden fields
Returns:
Type
Array.<Field>

indexFields() → {Array.<Field>}

Returns index fields
Returns:
Type
Array.<Field>

is(otherModel) → {boolean}

Returns if the model passed in the argument is equal to the current model
Parameters:
Name Type Description
otherModel Entity
Returns:
Type
boolean

isAuthModel() → {boolean}

Returns if this entity is auth model
Returns:
Type
boolean

isModel() → {boolean}

Returns if this entity is a model
Returns:
Type
boolean

isObligatoryParentOfAnotherEntity(entity) → {boolean}

Checks if the entity is parent of another entity, considering the relationships and foreign keys
Parameters:
Name Type Description
entity Entity
Returns:
Type
boolean

isTable() → {boolean}

Returns if this entity is a table
Returns:
Type
boolean

jsonFields() → {Array.<Field>}

Returns json fields
Returns:
Type
Array.<Field>

tableNameFollowsStandard() → {boolean}

Check if the table name follows the standard rule
Returns:
Type
boolean

uniqueFields() → {Array.<Field>}

Returns unique fields
Returns:
Type
Array.<Field>

validFields() → {Array.<Field>}

Returns all valid fields
Returns:
Type
Array.<Field>