Transactd PHP ORM 1.5.0
  • Namespace
  • Class

Namespaces

  • None
  • Transactd
    • boot
      • Laravel

Classes

  • AggregateFunction
  • CachedQueryExecuter
  • Collection
  • CollectionIterator
  • DatabaseManager
  • Model
  • QueryAdapter
  • QueryExecuter
  • Relation
  • TableForwordIterator
  • TableIterator
  • TableReverseIterator

Traits

  • JsonSerializable

Exceptions

  • IOException
  • ModelNotFoundException
  • ModelUserCancelException

Class Model

Transactd\Model uses Transactd\JsonSerializable
Namespace: Transactd
Located at Model.php

Methods summary

public
# __construct( array $params = null )

Constructer.

Constructer.

Parameters

$params
(optional) Properties hash. ['id' => 0]
public static
# clearTableCache( )

Clear the cache of this object instances.

Clear the cache of this object instances.

public static
# prepareTable( )

Prepare to table previously opened for the transaction.

Prepare to table previously opened for the transaction.

public static Transactd\QueryExecuter
# queryExecuter( string $className = null )

Get the QueryExecuter of this model.

Get the QueryExecuter of this model.

Parameters

$className
(optional)

Returns

Transactd\QueryExecuter
public array
# filterCreateAttribute( array $attributes )

Filtering the attributes for create model by the 'fillable' or 'guarded' property.

Filtering the attributes for create model by the 'fillable' or 'guarded' property.

Parameters

$attributes

Returns

array

Throws

LogicException
public mixed
# __get( string $name )

Implements of __get magic method. Get the relation object by method name. And execute the releation object. And set result to the property of the name.

Implements of __get magic method. Get the relation object by method name. And execute the releation object. And set result to the property of the name.

Parameters

$name

Returns

mixed

Throws

Exception
public string|string[]
# getPrimaryKeyFieldName( string|string[]|null $fieldNames )

Get the primary key field name(s) from $fieldNames. If $fieldNames is null return 'id'.

Get the primary key field name(s) from $fieldNames. If $fieldNames is null return 'id'.

Parameters

$fieldNames

Returns

string|string[]
protected Transactd\Relation
# morphToMany( string $className, string $name, string $IntermediateClass = null, integer|string|string[] $otherKey = null )

Get a relationship object of polymorphic many-to-many.

Get a relationship object of polymorphic many-to-many.

Parameters

$className
A class name of relationship.
$name
A base name of intermediate.
$IntermediateClass
(optional) A class name of intermediate.
$otherKey
(optional) A key of $className

Returns

Transactd\Relation
protected Transactd\Relation
# morphedByMany( string $className, string $name, string $IntermediateClass = null, integer|string|string[] $foreignKey = null, string[] $keyValuePropertyNames = null, $otherKey = null )

Get a relationship object of polymorphic opposite direction many-to-many.

Get a relationship object of polymorphic opposite direction many-to-many.

Parameters

$className
The class name of relationship.
$name
Intermediate name. This name is used for field name of intermediate table. Ex: $name.'_id' and $name.'_type'
$IntermediateClass
(optional) Intermediate class name.
$foreignKey
(optional) A key of $IntermediateClass.
$keyValuePropertyNames

(optional) Property name(s) of this or fixed value. \ Fixed values are enclosed in []
Ex:['[1]', 'id']

$otherKey

Returns

Transactd\Relation
protected Transactd\Relation
# morphTo( string $name = null, string $type = null, string $id = null, array $typeToClassMap = null )

Get a relationship object of polymorphic opposite direction one-to-one or many.

Get a relationship object of polymorphic opposite direction one-to-one or many.

Parameters

$name
(optional) Intermediate name. This name is used for field name of intermediate table. Ex: $name.'_id' and $name.'_type'
$type
(optional) The name of type field.
$id
(optional) The name of id field.
$typeToClassMap
(optional) Type number map of class name. Ex. [1 => Customer, 2 => Vendor]

Returns

Transactd\Relation
protected Transactd\Relation
# morphMany( string $className, string $name, string $type = null, string $id = null, string[] $keyValuePropertyNames = null, boolean $optimize = false )

Get a relationship object of polymorphic one-to-many.

Get a relationship object of polymorphic one-to-many.

Parameters

$className
A class name of relationship.
$name
A base name of fieid of type and id.
$type
(optional) The name of type field.
$id
(optional) The name of id field.
$keyValuePropertyNames

(optional) Property name(s) of this or fixed value. \ Fixed values are enclosed in []
Ex:['[1]', 'id']

$optimize

(optional) Whether to use the sort-merge or nested loop at the time of batch processing

  • true : sort-merge
  • false : nested loop

Returns

Transactd\Relation
protected Transactd\Relation
# morphOne( string $className, string $name, string $type = null, string $id = null, string[] $keyValuePropertyNames = null, boolean $optimize = false )

Get a relationship object of polymorphic one-to-one.

Get a relationship object of polymorphic one-to-one.

Parameters

$className
A class name of relationship.
$name
A base name of fieid of type and id.
$type
(optional) The name of type field.
$id
(optional) The name of id field.
$keyValuePropertyNames

(optional) Property name(s) of this or fixed value. \ Fixed values are enclosed in []
Ex:['[1]', 'id']

$optimize

(optional) Whether to use the sort-merge or nested loop at the time of batch processing

  • true : sort-merge
  • false : nested loop

Returns

Transactd\Relation
protected Transactd\Relation
# hasOne( string $className, integer|string|string[] $foreignKey = null, string[] $keyValuePropertyNames = null, boolean $optimize = false )

Get a relationship object of one-to-one.

Get a relationship object of one-to-one.

Parameters

$className
A class name of relationship.
$foreignKey
(optional) Key fields or index number of $className.
$keyValuePropertyNames
(optional) Property name(s) of this.
$optimize

(optional) Whether to use the sort-merge or nested loop at the time of batch processing

  • true : sort-merge
  • false : nested loop

Returns

Transactd\Relation
protected Transactd\Relation
# belongsTo( string $className, string[] $keyValuePropertyNames = null, integer|string|string[] $otherKey = 'id', boolean $optimize = true )

Get a relationship object of opposite direction one-to-one or many.

Get a relationship object of opposite direction one-to-one or many.

Parameters

$className
A class name of relationship.
$keyValuePropertyNames
(optional) Property name(s) of this.
$otherKey
(optional) Key fields or index number of $className
$optimize

(optional) Whether to use the sort-merge or nested loop at the time of batch processing

  • true : sort-merge
  • false : nested loop

Returns

Transactd\Relation
protected Transactd\Relation
# hasMany( string $className, integer|string|string[] $foreignKey = null, string[] $keyValuePropertyNames = null, boolean $optimize = false )

Get a relationship object of one-to-many.

Get a relationship object of one-to-many.

Parameters

$className
A class name of relationship.
$foreignKey
(optional) Key fields or index number of $className.
$keyValuePropertyNames
(optional) Property name(s) of this.
$optimize

(optional) Whether to use the sort-merge or nested loop at the time of batch processing

  • true : sort-merge
  • false : nested loop

Returns

Transactd\Relation
protected Transactd\Relation
# belongsToMany( string $className, string $IntermediateClass = null, integer|string|string[] $foreignKey = null, string[] $intermediatePropertyNames = null )

Get a relationship object of many-to-many.

Get a relationship object of many-to-many.

Parameters

$className
A class name of relationship.
$IntermediateClass
(optional) Intermediate class name.
$foreignKey
(optional) (optional) Key fields or index number of $IntermediateClass.
$intermediatePropertyNames
$intermediatePropertyNames property name(s) of intermediate class.

Returns

Transactd\Relation
public Transactd\Relation
# relation( string $className, integer $index, string[] $keyValuePropertyNames, null|boolean $optimize = null )

Get a relationship object.

Get a relationship object.

Parameters

$className
A class name of relationship.
$index
Index number of $className table for search.
$keyValuePropertyNames

(optional) Property name(s) of this or fixed value.
Fixed values are enclosed in []
Ex:['[1]', 'id']

$optimize

(optional) Whether to use the sort-merge or nested loop at the time of batch processing

  • true : sort-merge
  • false : nested loop

Returns

Transactd\Relation
public static
# resetQuery( )

Clear the query paramators.

Clear the query paramators.

public static object|null
# find( mixed|mixed[] $id, boolean $throwException = false )

Find a Model from the table by the current key.

Find a Model from the table by the current key.

Parameters

$id
The primary key values.
$throwException
Whether to return an error when an exception.

Returns

object|null

Throws

Transactd\ModelNotFoundException
public static Transactd\QueryExecuter
# index( integer $index )

Set the index number for search.

Set the index number for search.

Parameters

$index

Returns

Transactd\QueryExecuter
public static Transactd\QueryExecuter
# keyValue( mixed $v1, mixed $v2 = null, mixed $v3 = null, mixed $v4 = null, mixed $v5 = null, mixed $v6 = null, mixed $v7 = null, mixed $v8 = null )

Set key value(s) of current key.

Set key value(s) of current key.

Parameters

$v1
First segment value.
$v2
(optional) Second segment value.
$v3
(optional) Third segment value.
$v4
(optional) Fourth segment value.
$v5
(optional) Fifth segment value.
$v6
(optional) Sixth segment value.
$v7
(optional) Seventh segment value.
$v8
(optional) Eighth segment value.

Returns

Transactd\QueryExecuter
public static Transactd\Collection|BizStation\Transactd\Recordset
# all( boolean $toArray = true )

Reads all records from a table by the primary key.

Reads all records from a table by the primary key.

Parameters

$toArray
(optional) false: Get by recordset.

Returns

Transactd\Collection|BizStation\Transactd\Recordset
public static Transactd\QueryExecuter
# with( string $func )

Parameters

$func

Returns

Transactd\QueryExecuter
public static mixed
# __callStatic( string $name, mixed[] $arguments )

Implementation of __callStatic method.

Implementation of __callStatic method.

Fiest, if $name is present in the 'Transactd\CachedQueryExecuter' then redirect to a CachedQueryExecuter.
Second, If supper class has a 'scope' + $name method then invoke it.

Parameters

$name
$arguments

Returns

mixed

Throws

BadMethodCallException
public boolean
# save( boolean $options = null, integer $forceInsert = false )

To save this object to the database.

To save this object to the database.

Parameters

$options
$forceInsert
$forceInsert
$options

Returns

boolean

Throw

IOException
public boolean
# delete( integer $options = null )

To delete this object from the database.

To delete this object from the database.

Parameters

$options

Returns

boolean

Throw

IOException
public boolean
# refresh( )

Re-read from database and re-cache.

Re-read from database and re-cache.

Returns

boolean
public
# updateCache( type $clear = false )

Update this cache.

Update this cache.

Parameters

$clear
public Transactd\TableIterator
# serverCursor( integer $index = null, integer $op = Transactd\QueryExecuter::SEEK_EQUAL, integer $lockBias = Transactd\Transactd::LOCK_BIAS_DEFAULT, boolean $forword = true )

Get a server cursor. The keyValue uses this object properties. Finally call reset() to restore index and keyValue.

Get a server cursor. The keyValue uses this object properties. Finally call reset() to restore index and keyValue.

Parameters

$index
$op
$lockBias
$forword
Choicing ForwordIterator or ReverseIterator.

Returns

Transactd\TableIterator

Throw

IOException
public static
# resolveRelations( Transactd\Model[] $array, string|string[] $functionNames )

Relation models to batch acquisition.

Relation models to batch acquisition.

Parameters

$array
Model(s)
$functionNames
Relation function name(s) of Model(s)

Methods used from Transactd\JsonSerializable

assign(), chengeObjectType(), createInstance(), deSerializeFromJson(), fromJson(), getClassName(), serializeToJson(), toJson(), toString()

Constants summary

integer SAVE_WITH_RELATIONS

Also saves relational object(s).

Also saves relational object(s).

# 1

Properties summary

public static boolean $resolvByCache

Just before the reading operation, it indicates whether it was returned from the cache.

Just before the reading operation, it indicates whether it was returned from the cache.

# false

Properties used from Transactd\JsonSerializable

$className

Transactd PHP ORM 1.5.0 API documentation generated by ApiGen