class \mpf\datasources\sql\Relation

class \mpf\datasources\sql\Relation

-no description found-

Attributes
protected string $modelClass

-no description found-

protected mixed $connection

-no description found-

protected mixed $type

-no description found-

protected string $joinType = "LEFT JOIN"

-no description found-

protected string $limit

-no description found-

protected mixed $order

-no description found-

protected mixed $offset

-no description found-

protected mixed $group

-no description found-

protected string[] $compares = []

-no description found-

protected mixed $values = []

-no description found-

protected mixed $params = []

-no description found-

protected mixed $joins = []

-no description found-

protected string[] $_afterConditionParams

-no description found-

protected mixed $_afterConditionJoins = []

-no description found-

const BELONGS_TO = "1"

-no description found-

Methods

public static \mpf\datasources\sql\Relation belongsTo (string $modelClass, string $columnName, array $options = [])

  • $modelClass

    -no description found-

  • $columnName

    -no description found-

  • $options

    -no description found-

Create's a belongsTo relation

public static \mpf\datasources\sql\Relation hasOne (mixed $modelClass, mixed $columnName, array $options = [])

  • $modelClass

    -no description found-

  • $columnName

    -no description found-

  • $options

    -no description found-

Creates a hasOne relation

public static \mpf\datasources\sql\Relation hasMany (mixed $modelClass, mixed $columnName, array $options = [])

  • $modelClass

    -no description found-

  • $columnName

    -no description found-

  • $options

    -no description found-

Creates a hasMany relation

public static \mpf\datasources\sql\Relation manyToMany (mixed $modelClass, mixed $connection, array $options = [])

  • $modelClass

    -no description found-

  • $connection

    -no description found-

  • $options

    -no description found-

Creates a many2many relation

public \mpf\datasources\sql\Relation join (mixed $table, mixed $compare, mixed $condition, mixed $type = "LEFT JOIN", array $params = [])

  • $table

    -no description found-

  • $compare

    -no description found-

  • $condition

    -no description found-

  • $type

    -no description found-

  • $params

    -no description found-

-no description found-

public mixed compare (mixed $columns2columns, mixed $operator = "=", mixed $separator = " AND ")

  • $columns2columns

    -no description found-

  • $operator

    -no description found-

  • $separator

    -no description found-

-no description found-

public mixed values (mixed $columns2values, mixed $operator = "=", mixed $separator = " AND ")

  • $columns2values

    -no description found-

  • $operator

    -no description found-

  • $separator

    -no description found-

-no description found-

public mixed addCondition (mixed $condition, mixed $params = [], mixed $separator = " AND ")

  • $condition

    -no description found-

  • $params

    -no description found-

  • $separator

    -no description found-

-no description found-

public string getCondition (string $name, null $models = null)

  • $name
    • name is used to determine if it's a sub-condition or not and generate table name
  • $models

    -no description found-

If no models are sent will return for initial join, if not it will return a new query for selected models;

protected string _calcJoin ()

-no description found-

protected string _calcModels (\mpf\datasources\sql\DbModel[] $models)

  • $models

    -no description found-

-no description found-

public string getJoin ()

-no description found-

public string[] getParams ()

List of parameters to be used by query;