PHP Trait TORM\HasMany

Show file Open project: taq/torm

Public Methods

Method Description
hasHasMany ( string $attr ) : boolean Check if there is a has many association
hasMany ( string $attr, mixed $options = null ) : null Create a has many relationship
hasManyClass ( string $attr ) : the Check class from a relation, like hasManyClass("tickets") => "Ticket"
hasManyForeignKey ( string $attr ) : string Check if there is a has many foreign key
push ( mixed $obj ) : pushed Push an objet to a has many association

Private Methods

Method Description
_checkAndReturnMany ( string $method, mixed $value ) : has Check a has many association and returns it resolved, if exists.
_nullNotPresentIds ( string $klass, string $foreign, mixed $ids, string $id ) : null Nullify foreign class keys not present in array
_pushLater ( mixed $obj ) : null Send an object to push later
_resolveCollection ( string $attr, mixed $values ) : collections Set values to a has many association, from an array
_resolveHasMany ( string $attr, mixed $value ) : collection Resolve the has many association and returns the collection with values
_resolveIds ( string $attr, mixed $values = null ) : ids Resolve has many ids

Method Details

hasHasMany() public static method

Check if there is a has many association
public static hasHasMany ( string $attr ) : boolean
$attr string attribute to check
return boolean

hasMany() public static method

Create a has many relationship
public static hasMany ( string $attr, mixed $options = null ) : null
$attr string attribute
$options mixed to use
return null

hasManyClass() public static method

Check class from a relation, like hasManyClass("tickets") => "Ticket"
public static hasManyClass ( string $attr ) : the
$attr string attribute to check
return the class

hasManyForeignKey() public static method

Check if there is a has many foreign key
public static hasManyForeignKey ( string $attr ) : string
$attr string attribute
return string foreign key

push() public method

Push an objet to a has many association
public push ( mixed $obj ) : pushed
$obj mixed object
return pushed