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 Relation

Namespace: Transactd
Located at Relation.php

Methods summary

public
# __construct( string $srcClassName, string[] $srcKeyValueFieldNames, string $srcMethodName, string $destClassName, integer $destIndex, boolean $optimize, integer $type )

Parameters

$srcClassName
$srcKeyValueFieldNames

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

$srcMethodName
The owner class name of relationship.
$destClassName
The class name of relationship.
$destIndex
Index number of $destClassName table.
$optimize

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

  • true : sort-merge
  • false : nested loop
$type
The type number of relationship.
public Transactd\Relation
# setMorphClassMap( array $valueClassMap, array $valueClassMap,… )

Set a class-map for TYPE_MORPHTO

Set a class-map for TYPE_MORPHTO

Parameters

$valueClassMap
[[fieldValue => class name], ...]
$valueClassMap,…

Returns

Transactd\Relation
public integer
# getType( )

Get the relation type.

Get the relation type.

Returns

integer
public Transactd\Model|Transactd\Collection
# get( Transactd\Model $src )

Get the relation results from the database.

Get the relation results from the database.

Parameters

$src
The source model.

Returns

Transactd\Model|Transactd\Collection
public integer
# deleteAll( string $src )

Delete matched records by relationship conditions.

Delete matched records by relationship conditions.

Parameters

$src
The source model.

Returns

integer
Count of effects.
public
# resolveRelations( Transactd\Collection|Transactd\Model[] $srcMdls )

The relation of the specified collection, and then batch acquisition.

The relation of the specified collection, and then batch acquisition.

Parameters

$srcMdls
Collection of model

Throws

BadMethodCallException
public
# setParent( Transactd\Model $obj )

Set a parent model for relationship.

Set a parent model for relationship.

Parameters

$obj
public Transactd\Model
# create( array $attributes )

Create a new model by this relationship condition and attributes.
This operation do not save to database.

Create a new model by this relationship condition and attributes.
This operation do not save to database.

Parameters

$attributes

Returns

Transactd\Model

Throws

BadMethodCallException,
\InvalidArgumentException
public BizStataion\Transactd\Table
# getWritableTable( )

Get WritableTable for destClass

Get WritableTable for destClass

Returns

BizStataion\Transactd\Table
public boolean
# saveIntermediateItem( Transactd\Model $parent, Transactd\Model $child )

Save the intermediate model of many-to-many, to the database.

Save the intermediate model of many-to-many, to the database.

Parameters

$parent
$child

Returns

boolean
public boolean
# deleteIntermediateItem( Transactd\Model $parent, Transactd\Model $child )

Delete the intermediate object of many-to-many, from the database.

Delete the intermediate object of many-to-many, from the database.

Parameters

$parent
$child

Returns

boolean
public Transactd\Model
# save( Transactd\Model $model )

Save the relationship result model to the database.

Save the relationship result model to the database.

Parameters

$model

Returns

Transactd\Model

Throws

InvalidArgumentException
public
# copyParentValues( Transactd\Model $child )

Copy the parent model values of relationship.

Copy the parent model values of relationship.

Parameters

$child

Throws

InvalidArgumentException
public Transactd\Model
# associate( Transactd\Model $model )

Associate the model instance to the this parent.

Associate the model instance to the this parent.

Parameters

$model

Returns

Transactd\Model

Throws

BadMethodCallException
public Transactd\Model
# dissociate( Transactd\Model $model,… )

Dissociate the model from the this parent.

Dissociate the model from the this parent.

Parameters

$model,…

Returns

Transactd\Model

Throws

BadMethodCallException
public Transactd\Relation
# addSubRelation( string $className, integer $index, string[] $keyValueFieldNames, integer $type = self::TYPE_BELONGSTO )

Add a sub relationship model for many-to-many.

Add a sub relationship model for many-to-many.

Parameters

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

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

$type
(optional) TThe type of relationship.

Returns

Transactd\Relation

Throws

BadMethodCallException
public
# setSubRelation( Transactd\Relation $rel )

Add a sub relationship object for many-to-many.

Add a sub relationship object for many-to-many.

Parameters

$rel
A relationship object

Throws

BadMethodCallException
public boolean
# hasSubReleation( )

It returns whether there is a sub-relation.

It returns whether there is a sub-relation.

Returns

boolean

Constants summary

integer TYPE_HAS_ONE
# 0
integer TYPE_HAS_MANY
# 1
integer TYPE_BELONGSTO
# 2
integer TYPE_BELONGSTO_MANY
# 3
integer TYPE_MORPHONE
# 4
integer TYPE_MORPHMANY
# 5
integer TYPE_MORPHTO
# 6
integer TYPE_MORPHEDBYMANY
# 7
Transactd PHP ORM 1.5.0 API documentation generated by ApiGen