repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
analogueorm/analogue
src/EntityMap.php
EntityMap.getCompiledAttributes
public function getCompiledAttributes(): array { $key = $this->getKeyName(); $embeddables = array_keys($this->getEmbeddables()); $relationships = $this->getRelationships(); $attributes = $this->getAttributes(); return array_merge([$key], $embeddables, $relationships, $att...
php
public function getCompiledAttributes(): array { $key = $this->getKeyName(); $embeddables = array_keys($this->getEmbeddables()); $relationships = $this->getRelationships(); $attributes = $this->getAttributes(); return array_merge([$key], $embeddables, $relationships, $att...
[ "public", "function", "getCompiledAttributes", "(", ")", ":", "array", "{", "$", "key", "=", "$", "this", "->", "getKeyName", "(", ")", ";", "$", "embeddables", "=", "array_keys", "(", "$", "this", "->", "getEmbeddables", "(", ")", ")", ";", "$", "rela...
Get all the attribute names for the class, including relationships, embeddables and primary key. @return array
[ "Get", "all", "the", "attribute", "names", "for", "the", "class", "including", "relationships", "embeddables", "and", "primary", "key", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L356-L367
analogueorm/analogue
src/EntityMap.php
EntityMap.getProperties
public function getProperties(): array { return get_parent_class(__CLASS__) !== false ? array_unique(array_merge($this->properties, parent::getProperties())) : $this->properties; }
php
public function getProperties(): array { return get_parent_class(__CLASS__) !== false ? array_unique(array_merge($this->properties, parent::getProperties())) : $this->properties; }
[ "public", "function", "getProperties", "(", ")", ":", "array", "{", "return", "get_parent_class", "(", "__CLASS__", ")", "!==", "false", "?", "array_unique", "(", "array_merge", "(", "$", "this", "->", "properties", ",", "parent", "::", "getProperties", "(", ...
Return attributes that should be mapped to class properties. @return array
[ "Return", "attributes", "that", "should", "be", "mapped", "to", "class", "properties", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L490-L495
analogueorm/analogue
src/EntityMap.php
EntityMap.getEmptyValueForRelationship
public function getEmptyValueForRelationship(string $relation) { if ($this->isSingleRelationship($relation)) { return; } if ($this->isManyRelationship($relation)) { return new Collection(); } throw new MappingException("Cannot determine default value...
php
public function getEmptyValueForRelationship(string $relation) { if ($this->isSingleRelationship($relation)) { return; } if ($this->isManyRelationship($relation)) { return new Collection(); } throw new MappingException("Cannot determine default value...
[ "public", "function", "getEmptyValueForRelationship", "(", "string", "$", "relation", ")", "{", "if", "(", "$", "this", "->", "isSingleRelationship", "(", "$", "relation", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "isManyRelationship",...
Return empty value for a given relationship. @param string $relation @throws MappingException @return mixed
[ "Return", "empty", "value", "for", "a", "given", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L614-L625
analogueorm/analogue
src/EntityMap.php
EntityMap.getEmptyValueForLocalKey
public function getEmptyValueForLocalKey(string $relation) { if ($this->isPolymorphic($relation)) { $key = $this->localForeignKeys[$relation]; return [ $key['type'] => null, $key['id'] => null, ]; } if ($this->isManyRela...
php
public function getEmptyValueForLocalKey(string $relation) { if ($this->isPolymorphic($relation)) { $key = $this->localForeignKeys[$relation]; return [ $key['type'] => null, $key['id'] => null, ]; } if ($this->isManyRela...
[ "public", "function", "getEmptyValueForLocalKey", "(", "string", "$", "relation", ")", "{", "if", "(", "$", "this", "->", "isPolymorphic", "(", "$", "relation", ")", ")", "{", "$", "key", "=", "$", "this", "->", "localForeignKeys", "[", "$", "relation", ...
Return empty value for a local foreign key. @param string $relation @return mixed
[ "Return", "empty", "value", "for", "a", "local", "foreign", "key", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L634-L648
analogueorm/analogue
src/EntityMap.php
EntityMap.getLocalKeys
public function getLocalKeys($relation) { return isset($this->localForeignKeys[$relation]) ? $this->localForeignKeys[$relation] : null; }
php
public function getLocalKeys($relation) { return isset($this->localForeignKeys[$relation]) ? $this->localForeignKeys[$relation] : null; }
[ "public", "function", "getLocalKeys", "(", "$", "relation", ")", "{", "return", "isset", "(", "$", "this", "->", "localForeignKeys", "[", "$", "relation", "]", ")", "?", "$", "this", "->", "localForeignKeys", "[", "$", "relation", "]", ":", "null", ";", ...
Return the local keys associated to the relationship. @param string $relation @return string|array|null
[ "Return", "the", "local", "keys", "associated", "to", "the", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L667-L670
analogueorm/analogue
src/EntityMap.php
EntityMap.addSingleRelation
protected function addSingleRelation(string $relation) { if (!in_array($relation, $this->singleRelations)) { $this->singleRelations[] = $relation; } }
php
protected function addSingleRelation(string $relation) { if (!in_array($relation, $this->singleRelations)) { $this->singleRelations[] = $relation; } }
[ "protected", "function", "addSingleRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "singleRelations", ")", ")", "{", "$", "this", "->", "singleRelations", "[", "]", "=", "$", ...
Add a single relation method name once. @param string $relation
[ "Add", "a", "single", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L925-L930
analogueorm/analogue
src/EntityMap.php
EntityMap.addForeignRelation
protected function addForeignRelation(string $relation) { if (!in_array($relation, $this->foreignRelations)) { $this->foreignRelations[] = $relation; } }
php
protected function addForeignRelation(string $relation) { if (!in_array($relation, $this->foreignRelations)) { $this->foreignRelations[] = $relation; } }
[ "protected", "function", "addForeignRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "foreignRelations", ")", ")", "{", "$", "this", "->", "foreignRelations", "[", "]", "=", "$...
Add a foreign relation method name once. @param string $relation
[ "Add", "a", "foreign", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L937-L942
analogueorm/analogue
src/EntityMap.php
EntityMap.addPolymorphicRelation
protected function addPolymorphicRelation(string $relation) { if (!in_array($relation, $this->polymorphicRelations)) { $this->polymorphicRelations[] = $relation; } }
php
protected function addPolymorphicRelation(string $relation) { if (!in_array($relation, $this->polymorphicRelations)) { $this->polymorphicRelations[] = $relation; } }
[ "protected", "function", "addPolymorphicRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "polymorphicRelations", ")", ")", "{", "$", "this", "->", "polymorphicRelations", "[", "]",...
Add a polymorphic relation method name once. @param string $relation
[ "Add", "a", "polymorphic", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L949-L954
analogueorm/analogue
src/EntityMap.php
EntityMap.addNonProxyRelation
protected function addNonProxyRelation(string $relation) { if (!in_array($relation, $this->nonProxyRelationships)) { $this->nonProxyRelationships[] = $relation; } }
php
protected function addNonProxyRelation(string $relation) { if (!in_array($relation, $this->nonProxyRelationships)) { $this->nonProxyRelationships[] = $relation; } }
[ "protected", "function", "addNonProxyRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "nonProxyRelationships", ")", ")", "{", "$", "this", "->", "nonProxyRelationships", "[", "]", ...
Add a non proxy relation method name once. @param string $relation
[ "Add", "a", "non", "proxy", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L961-L966
analogueorm/analogue
src/EntityMap.php
EntityMap.addLocalRelation
protected function addLocalRelation(string $relation) { if (!in_array($relation, $this->localRelations)) { $this->localRelations[] = $relation; } }
php
protected function addLocalRelation(string $relation) { if (!in_array($relation, $this->localRelations)) { $this->localRelations[] = $relation; } }
[ "protected", "function", "addLocalRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "localRelations", ")", ")", "{", "$", "this", "->", "localRelations", "[", "]", "=", "$", "...
Add a local relation method name once. @param string $relation
[ "Add", "a", "local", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L973-L978
analogueorm/analogue
src/EntityMap.php
EntityMap.addManyRelation
protected function addManyRelation(string $relation) { if (!in_array($relation, $this->manyRelations)) { $this->manyRelations[] = $relation; } }
php
protected function addManyRelation(string $relation) { if (!in_array($relation, $this->manyRelations)) { $this->manyRelations[] = $relation; } }
[ "protected", "function", "addManyRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "manyRelations", ")", ")", "{", "$", "this", "->", "manyRelations", "[", "]", "=", "$", "rel...
Add a many relation method name once. @param string $relation
[ "Add", "a", "many", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L985-L990
analogueorm/analogue
src/EntityMap.php
EntityMap.addPivotRelation
protected function addPivotRelation(string $relation) { if (!in_array($relation, $this->pivotRelations)) { $this->pivotRelations[] = $relation; } }
php
protected function addPivotRelation(string $relation) { if (!in_array($relation, $this->pivotRelations)) { $this->pivotRelations[] = $relation; } }
[ "protected", "function", "addPivotRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "pivotRelations", ")", ")", "{", "$", "this", "->", "pivotRelations", "[", "]", "=", "$", "...
Add a pivot relation method name once. @param string $relation
[ "Add", "a", "pivot", "relation", "method", "name", "once", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L997-L1002
analogueorm/analogue
src/EntityMap.php
EntityMap.addEmbeddedRelation
protected function addEmbeddedRelation(string $relation) { if (!in_array($relation, $this->embeddedRelations)) { $this->embeddedRelations[] = $relation; } }
php
protected function addEmbeddedRelation(string $relation) { if (!in_array($relation, $this->embeddedRelations)) { $this->embeddedRelations[] = $relation; } }
[ "protected", "function", "addEmbeddedRelation", "(", "string", "$", "relation", ")", "{", "if", "(", "!", "in_array", "(", "$", "relation", ",", "$", "this", "->", "embeddedRelations", ")", ")", "{", "$", "this", "->", "embeddedRelations", "[", "]", "=", ...
Add an embedded relation. @param string $relation
[ "Add", "an", "embedded", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1009-L1014
analogueorm/analogue
src/EntityMap.php
EntityMap.embedsOne
public function embedsOne($parent, string $relatedClass, string $relation = null): EmbedsOne { if (is_null($relation)) { list(, $caller) = debug_backtrace(false); $relation = $caller['function']; } $this->addEmbeddedRelation($relation); $this->addNonProxyRela...
php
public function embedsOne($parent, string $relatedClass, string $relation = null): EmbedsOne { if (is_null($relation)) { list(, $caller) = debug_backtrace(false); $relation = $caller['function']; } $this->addEmbeddedRelation($relation); $this->addNonProxyRela...
[ "public", "function", "embedsOne", "(", "$", "parent", ",", "string", "$", "relatedClass", ",", "string", "$", "relation", "=", "null", ")", ":", "EmbedsOne", "{", "if", "(", "is_null", "(", "$", "relation", ")", ")", "{", "list", "(", ",", "$", "cal...
Define an Embedded Object. @param mixed $parent @param string $relatedClass @param string $relation @return EmbedsOne
[ "Define", "an", "Embedded", "Object", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1025-L1036
analogueorm/analogue
src/EntityMap.php
EntityMap.embedsMany
public function embedsMany($parent, string $relatedClass, string $relation = null): EmbedsMany { if (is_null($relation)) { list(, $caller) = debug_backtrace(false); $relation = $caller['function']; } $this->addEmbeddedRelation($relation); $this->addNonProxyRe...
php
public function embedsMany($parent, string $relatedClass, string $relation = null): EmbedsMany { if (is_null($relation)) { list(, $caller) = debug_backtrace(false); $relation = $caller['function']; } $this->addEmbeddedRelation($relation); $this->addNonProxyRe...
[ "public", "function", "embedsMany", "(", "$", "parent", ",", "string", "$", "relatedClass", ",", "string", "$", "relation", "=", "null", ")", ":", "EmbedsMany", "{", "if", "(", "is_null", "(", "$", "relation", ")", ")", "{", "list", "(", ",", "$", "c...
Define an Embedded Collection. @param mixed $parent @param string $relatedClass @param string $relation @return EmbedsMany
[ "Define", "an", "Embedded", "Collection", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1047-L1058
analogueorm/analogue
src/EntityMap.php
EntityMap.hasOne
public function hasOne($entity, string $related, string $foreignKey = null, string $localKey = null): HasOne { $foreignKey = $foreignKey ?: $this->getForeignKey(); $relatedMapper = Manager::getInstance()->mapper($related); $relatedMap = $relatedMapper->getEntityMap(); $localKey = ...
php
public function hasOne($entity, string $related, string $foreignKey = null, string $localKey = null): HasOne { $foreignKey = $foreignKey ?: $this->getForeignKey(); $relatedMapper = Manager::getInstance()->mapper($related); $relatedMap = $relatedMapper->getEntityMap(); $localKey = ...
[ "public", "function", "hasOne", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "foreignKey", "=", "null", ",", "string", "$", "localKey", "=", "null", ")", ":", "HasOne", "{", "$", "foreignKey", "=", "$", "foreignKey", "?", ":",...
Define a one-to-one relationship. @param mixed $entity @param string $related entity class @param string $foreignKey @param string $localKey @throws MappingException @return \Analogue\ORM\Relationships\HasOne
[ "Define", "a", "one", "-", "to", "-", "one", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1072-L1098
analogueorm/analogue
src/EntityMap.php
EntityMap.morphOne
public function morphOne( $entity, string $related, string $name, string $type = null, string $id = null, string $localKey = null ): MorphOne { list($type, $id) = $this->getMorphs($name, $type, $id); $localKey = $localKey ?: $this->getKeyName(); ...
php
public function morphOne( $entity, string $related, string $name, string $type = null, string $id = null, string $localKey = null ): MorphOne { list($type, $id) = $this->getMorphs($name, $type, $id); $localKey = $localKey ?: $this->getKeyName(); ...
[ "public", "function", "morphOne", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "name", ",", "string", "$", "type", "=", "null", ",", "string", "$", "id", "=", "null", ",", "string", "$", "localKey", "=", "null", ")", ":", ...
Define a polymorphic one-to-one relationship. @param mixed $entity @param string $related @param string $name @param string|null $type @param string|null $id @param string|null $localKey @throws MappingException @return \Analogue\ORM\Relationships\MorphOne
[ "Define", "a", "polymorphic", "one", "-", "to", "-", "one", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1114-L1146
analogueorm/analogue
src/EntityMap.php
EntityMap.belongsTo
public function belongsTo($entity, string $related, string $foreignKey = null, string $otherKey = null): BelongsTo { // Add the relation to the definition in map list(, $caller) = debug_backtrace(false); $relation = $caller['function']; $this->relatedClasses[$relation] = $related; ...
php
public function belongsTo($entity, string $related, string $foreignKey = null, string $otherKey = null): BelongsTo { // Add the relation to the definition in map list(, $caller) = debug_backtrace(false); $relation = $caller['function']; $this->relatedClasses[$relation] = $related; ...
[ "public", "function", "belongsTo", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "foreignKey", "=", "null", ",", "string", "$", "otherKey", "=", "null", ")", ":", "BelongsTo", "{", "// Add the relation to the definition in map", "list", ...
Define an inverse one-to-one or many relationship. @param mixed $entity @param string $related @param string|null $foreignKey @param string|null $otherKey @throws MappingException @return \Analogue\ORM\Relationships\BelongsTo
[ "Define", "an", "inverse", "one", "-", "to", "-", "one", "or", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1160-L1184
analogueorm/analogue
src/EntityMap.php
EntityMap.morphTo
public function morphTo($entity, string $name = null, string $type = null, string $id = null): MorphTo { // If no name is provided, we will use the backtrace to get the function name // since that is most likely the name of the polymorphic interface. We can // use that to get both the class ...
php
public function morphTo($entity, string $name = null, string $type = null, string $id = null): MorphTo { // If no name is provided, we will use the backtrace to get the function name // since that is most likely the name of the polymorphic interface. We can // use that to get both the class ...
[ "public", "function", "morphTo", "(", "$", "entity", ",", "string", "$", "name", "=", "null", ",", "string", "$", "type", "=", "null", ",", "string", "$", "id", "=", "null", ")", ":", "MorphTo", "{", "// If no name is provided, we will use the backtrace to get...
Define a polymorphic, inverse one-to-one or many relationship. @param mixed $entity @param string|null $name @param string|null $type @param string|null $id @throws MappingException @return \Analogue\ORM\Relationships\MorphTo
[ "Define", "a", "polymorphic", "inverse", "one", "-", "to", "-", "one", "or", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1198-L1259
analogueorm/analogue
src/EntityMap.php
EntityMap.hasMany
public function hasMany($entity, string $related, string $foreignKey = null, string $localKey = null): HasMany { $foreignKey = $foreignKey ?: $this->getForeignKey(); $relatedMapper = Manager::getInstance()->mapper($related); $localKey = $localKey ?: $this->getKeyName(); // Add the...
php
public function hasMany($entity, string $related, string $foreignKey = null, string $localKey = null): HasMany { $foreignKey = $foreignKey ?: $this->getForeignKey(); $relatedMapper = Manager::getInstance()->mapper($related); $localKey = $localKey ?: $this->getKeyName(); // Add the...
[ "public", "function", "hasMany", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "foreignKey", "=", "null", ",", "string", "$", "localKey", "=", "null", ")", ":", "HasMany", "{", "$", "foreignKey", "=", "$", "foreignKey", "?", ":...
Define a one-to-many relationship. @param mixed $entity @param string $related @param string|null $foreignKey @param string|null $localKey @throws MappingException @return \Analogue\ORM\Relationships\HasMany
[ "Define", "a", "one", "-", "to", "-", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1273-L1290
analogueorm/analogue
src/EntityMap.php
EntityMap.hasManyThrough
public function hasManyThrough( $entity, string $related, string $through, string $firstKey = null, string $secondKey = null ): HasManyThrough { $relatedMapper = Manager::getInstance()->mapper($related); $throughMapper = Manager::getInstance()->mapper($through...
php
public function hasManyThrough( $entity, string $related, string $through, string $firstKey = null, string $secondKey = null ): HasManyThrough { $relatedMapper = Manager::getInstance()->mapper($related); $throughMapper = Manager::getInstance()->mapper($through...
[ "public", "function", "hasManyThrough", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "through", ",", "string", "$", "firstKey", "=", "null", ",", "string", "$", "secondKey", "=", "null", ")", ":", "HasManyThrough", "{", "$", "re...
Define a has-many-through relationship. @param mixed $entity @param string $related @param string $through @param string|null $firstKey @param string|null $secondKey @throws MappingException @return \Analogue\ORM\Relationships\HasManyThrough
[ "Define", "a", "has", "-", "many", "-", "through", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1305-L1330
analogueorm/analogue
src/EntityMap.php
EntityMap.morphMany
public function morphMany( $entity, string $related, string $name, string $type = null, string $id = null, string $localKey = null ): MorphMany { // Here we will gather up the morph type and ID for the relationship so that we // can properly query the ...
php
public function morphMany( $entity, string $related, string $name, string $type = null, string $id = null, string $localKey = null ): MorphMany { // Here we will gather up the morph type and ID for the relationship so that we // can properly query the ...
[ "public", "function", "morphMany", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "name", ",", "string", "$", "type", "=", "null", ",", "string", "$", "id", "=", "null", ",", "string", "$", "localKey", "=", "null", ")", ":", ...
Define a polymorphic one-to-many relationship. @param mixed $entity @param string $related @param string $name @param string|null $type @param string|null $id @param string|null $localKey @return \Analogue\ORM\Relationships\MorphMany
[ "Define", "a", "polymorphic", "one", "-", "to", "-", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1344-L1372
analogueorm/analogue
src/EntityMap.php
EntityMap.belongsToMany
public function belongsToMany( $entity, string $related, string $table = null, string $foreignKey = null, string $otherKey = null ): BelongsToMany { // Add the relation to the definition in map list(, $caller) = debug_backtrace(false); $relation = $cal...
php
public function belongsToMany( $entity, string $related, string $table = null, string $foreignKey = null, string $otherKey = null ): BelongsToMany { // Add the relation to the definition in map list(, $caller) = debug_backtrace(false); $relation = $cal...
[ "public", "function", "belongsToMany", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "table", "=", "null", ",", "string", "$", "foreignKey", "=", "null", ",", "string", "$", "otherKey", "=", "null", ")", ":", "BelongsToMany", "{"...
Define a many-to-many relationship. @param mixed $entity @param string $related @param string|null $table @param string|null $foreignKey @param string|null $otherKey @throws MappingException @return \Analogue\ORM\Relationships\BelongsToMany
[ "Define", "a", "many", "-", "to", "-", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1387-L1422
analogueorm/analogue
src/EntityMap.php
EntityMap.morphToMany
public function morphToMany( $entity, string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null, bool $inverse = false ): MorphToMany { // Add the relation to the definition in map list(, $caller) =...
php
public function morphToMany( $entity, string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null, bool $inverse = false ): MorphToMany { // Add the relation to the definition in map list(, $caller) =...
[ "public", "function", "morphToMany", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "name", ",", "string", "$", "table", "=", "null", ",", "string", "$", "foreignKey", "=", "null", ",", "string", "$", "otherKey", "=", "null", ",...
Define a polymorphic many-to-many relationship. @param mixed $entity @param string $related @param string $name @param string|null $table @param string|null $foreignKey @param string|null $otherKey @param bool $inverse @throws MappingException @return \Analogue\ORM\Relationships\MorphToMany
[ "Define", "a", "polymorphic", "many", "-", "to", "-", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1439-L1469
analogueorm/analogue
src/EntityMap.php
EntityMap.morphedByMany
public function morphedByMany( $entity, string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null ): MorphToMany { // Add the relation to the definition in map list(, $caller) = debug_backtrace(false); ...
php
public function morphedByMany( $entity, string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null ): MorphToMany { // Add the relation to the definition in map list(, $caller) = debug_backtrace(false); ...
[ "public", "function", "morphedByMany", "(", "$", "entity", ",", "string", "$", "related", ",", "string", "$", "name", ",", "string", "$", "table", "=", "null", ",", "string", "$", "foreignKey", "=", "null", ",", "string", "$", "otherKey", "=", "null", ...
Define a polymorphic, inverse many-to-many relationship. @param mixed $entity @param string $related @param string $name @param string|null $table @param string|null $foreignKey @param string|null $otherKey @throws MappingException @return \Analogue\ORM\Relationships\MorphToMany
[ "Define", "a", "polymorphic", "inverse", "many", "-", "to", "-", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1485-L1509
analogueorm/analogue
src/EntityMap.php
EntityMap.joiningTable
public function joiningTable(self $relatedMap): string { // The joining table name, by convention, is simply the snake cased models // sorted alphabetically and concatenated with an underscore, so we can // just sort the models and join them together to get the table name. $base = $t...
php
public function joiningTable(self $relatedMap): string { // The joining table name, by convention, is simply the snake cased models // sorted alphabetically and concatenated with an underscore, so we can // just sort the models and join them together to get the table name. $base = $t...
[ "public", "function", "joiningTable", "(", "self", "$", "relatedMap", ")", ":", "string", "{", "// The joining table name, by convention, is simply the snake cased models", "// sorted alphabetically and concatenated with an underscore, so we can", "// just sort the models and join them tog...
Get the joining table name for a many-to-many relation. @param EntityMap $relatedMap @return string
[ "Get", "the", "joining", "table", "name", "for", "a", "many", "-", "to", "-", "many", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1518-L1535
analogueorm/analogue
src/EntityMap.php
EntityMap.getMorphs
protected function getMorphs(string $name, string $type = null, string $id = null): array { return [ $type ?: $name.'_type', $id ?: $name.'_id', ]; }
php
protected function getMorphs(string $name, string $type = null, string $id = null): array { return [ $type ?: $name.'_type', $id ?: $name.'_id', ]; }
[ "protected", "function", "getMorphs", "(", "string", "$", "name", ",", "string", "$", "type", "=", "null", ",", "string", "$", "id", "=", "null", ")", ":", "array", "{", "return", "[", "$", "type", "?", ":", "$", "name", ".", "'_type'", ",", "$", ...
Get the polymorphic relationship columns. @param string $name @param string $type @param string $id @return string[]
[ "Get", "the", "polymorphic", "relationship", "columns", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1546-L1552
analogueorm/analogue
src/EntityMap.php
EntityMap.getMorphClass
public function getMorphClass(): string { $morphClass = Manager::getInstance()->getMorphMap($this->getClass()); return $this->morphClass ?: $morphClass; }
php
public function getMorphClass(): string { $morphClass = Manager::getInstance()->getMorphMap($this->getClass()); return $this->morphClass ?: $morphClass; }
[ "public", "function", "getMorphClass", "(", ")", ":", "string", "{", "$", "morphClass", "=", "Manager", "::", "getInstance", "(", ")", "->", "getMorphMap", "(", "$", "this", "->", "getClass", "(", ")", ")", ";", "return", "$", "this", "->", "morphClass",...
Get the class name for polymorphic relations. @return string
[ "Get", "the", "class", "name", "for", "polymorphic", "relations", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1559-L1564
analogueorm/analogue
src/EntityMap.php
EntityMap.initialize
public function initialize() { $userMethods = $this->getCustomMethods(); // Parse EntityMap for method based relationship if (count($userMethods) > 0) { $this->relationships = $this->parseMethodsForRelationship($userMethods); } // Parse EntityMap for dynamic rel...
php
public function initialize() { $userMethods = $this->getCustomMethods(); // Parse EntityMap for method based relationship if (count($userMethods) > 0) { $this->relationships = $this->parseMethodsForRelationship($userMethods); } // Parse EntityMap for dynamic rel...
[ "public", "function", "initialize", "(", ")", "{", "$", "userMethods", "=", "$", "this", "->", "getCustomMethods", "(", ")", ";", "// Parse EntityMap for method based relationship", "if", "(", "count", "(", "$", "userMethods", ")", ">", "0", ")", "{", "$", "...
Process EntityMap parsing at initialization time. @return void
[ "Process", "EntityMap", "parsing", "at", "initialization", "time", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1583-L1596
analogueorm/analogue
src/EntityMap.php
EntityMap.parseMethodsForRelationship
protected function parseMethodsForRelationship(array $customMethods): array { $relationships = []; $class = new ReflectionClass(get_class($this)); // Get the mapped Entity class, as we will detect relationships // methods by testing that the first argument is type-hinted to ...
php
protected function parseMethodsForRelationship(array $customMethods): array { $relationships = []; $class = new ReflectionClass(get_class($this)); // Get the mapped Entity class, as we will detect relationships // methods by testing that the first argument is type-hinted to ...
[ "protected", "function", "parseMethodsForRelationship", "(", "array", "$", "customMethods", ")", ":", "array", "{", "$", "relationships", "=", "[", "]", ";", "$", "class", "=", "new", "ReflectionClass", "(", "get_class", "(", "$", "this", ")", ")", ";", "/...
Parse user's class methods for relationships. @param array $customMethods @return array
[ "Parse", "user", "s", "class", "methods", "for", "relationships", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1644-L1668
analogueorm/analogue
src/EntityMap.php
EntityMap.sortRelationshipsByType
protected function sortRelationshipsByType() { $entityClass = $this->getClass(); // Instantiate a dummy entity which we will pass to relationship methods. $entity = unserialize(sprintf('O:%d:"%s":0:{}', strlen($entityClass), $entityClass)); foreach ($this->relationships as $relatio...
php
protected function sortRelationshipsByType() { $entityClass = $this->getClass(); // Instantiate a dummy entity which we will pass to relationship methods. $entity = unserialize(sprintf('O:%d:"%s":0:{}', strlen($entityClass), $entityClass)); foreach ($this->relationships as $relatio...
[ "protected", "function", "sortRelationshipsByType", "(", ")", "{", "$", "entityClass", "=", "$", "this", "->", "getClass", "(", ")", ";", "// Instantiate a dummy entity which we will pass to relationship methods.", "$", "entity", "=", "unserialize", "(", "sprintf", "(",...
Sort Relationships methods by type. TODO : replace this by directly setting these value in the corresponding methods, so we won't need the correspondency table @return void
[ "Sort", "Relationships", "methods", "by", "type", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1679-L1689
analogueorm/analogue
src/EntityMap.php
EntityMap.getAttributeNamesFromColumns
public function getAttributeNamesFromColumns($array) { if (!empty($this->mappings)) { $newArray = []; foreach ($array as $key => $value) { $attributeName = isset($this->mappings[$key]) ? $this->mappings[$key] : $key; $newArray[$attributeName] = $value;...
php
public function getAttributeNamesFromColumns($array) { if (!empty($this->mappings)) { $newArray = []; foreach ($array as $key => $value) { $attributeName = isset($this->mappings[$key]) ? $this->mappings[$key] : $key; $newArray[$attributeName] = $value;...
[ "public", "function", "getAttributeNamesFromColumns", "(", "$", "array", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "mappings", ")", ")", "{", "$", "newArray", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", ...
Maps the names of the column names to the appropriate attributes of an entity if the $attributes property of an EntityMap is an associative array. @param array $array @return array
[ "Maps", "the", "names", "of", "the", "column", "names", "to", "the", "appropriate", "attributes", "of", "an", "entity", "if", "the", "$attributes", "property", "of", "an", "EntityMap", "is", "an", "associative", "array", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1733-L1755
analogueorm/analogue
src/EntityMap.php
EntityMap.getColumnNamesFromAttributes
public function getColumnNamesFromAttributes($array) { if (!empty($this->mappings)) { $newArray = []; $flipped = array_flip($this->mappings); foreach ($array as $key => $value) { $attributeName = isset($flipped[$key]) ? $flipped[$key] : $key; ...
php
public function getColumnNamesFromAttributes($array) { if (!empty($this->mappings)) { $newArray = []; $flipped = array_flip($this->mappings); foreach ($array as $key => $value) { $attributeName = isset($flipped[$key]) ? $flipped[$key] : $key; ...
[ "public", "function", "getColumnNamesFromAttributes", "(", "$", "array", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "mappings", ")", ")", "{", "$", "newArray", "=", "[", "]", ";", "$", "flipped", "=", "array_flip", "(", "$", "this", "...
Maps the attribute names of an entity to the appropriate column names in the database if the $attributes property of an EntityMap is an associative array. @param array $array @return array
[ "Maps", "the", "attribute", "names", "of", "an", "entity", "to", "the", "appropriate", "column", "names", "in", "the", "database", "if", "the", "$attributes", "property", "of", "an", "EntityMap", "is", "an", "associative", "array", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L1784-L1807
analogueorm/analogue
src/Relationships/HasOneOrMany.php
HasOneOrMany.detachExcept
protected function detachExcept($entities) { $query = $this->query->getQuery()->from($this->relatedMap->getTable()); if (count($entities) > 0) { $keys = $this->getKeys($entities); $query->whereNotIn($this->relatedMap->getKeyName(), $keys); } $parentKey = $th...
php
protected function detachExcept($entities) { $query = $this->query->getQuery()->from($this->relatedMap->getTable()); if (count($entities) > 0) { $keys = $this->getKeys($entities); $query->whereNotIn($this->relatedMap->getKeyName(), $keys); } $parentKey = $th...
[ "protected", "function", "detachExcept", "(", "$", "entities", ")", "{", "$", "query", "=", "$", "this", "->", "query", "->", "getQuery", "(", ")", "->", "from", "(", "$", "this", "->", "relatedMap", "->", "getTable", "(", ")", ")", ";", "if", "(", ...
@param $entities @throws \InvalidArgumentException
[ "@param", "$entities" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasOneOrMany.php#L91-L104
analogueorm/analogue
src/Relationships/HasOneOrMany.php
HasOneOrMany.addEagerConstraints
public function addEagerConstraints(array $results) { $this->query->whereIn($this->foreignKey, $this->getKeysFromResults($results, $this->localKey)); }
php
public function addEagerConstraints(array $results) { $this->query->whereIn($this->foreignKey, $this->getKeysFromResults($results, $this->localKey)); }
[ "public", "function", "addEagerConstraints", "(", "array", "$", "results", ")", "{", "$", "this", "->", "query", "->", "whereIn", "(", "$", "this", "->", "foreignKey", ",", "$", "this", "->", "getKeysFromResults", "(", "$", "results", ",", "$", "this", "...
Set the constraints for an eager load of the relation. @param array $results @return void
[ "Set", "the", "constraints", "for", "an", "eager", "load", "of", "the", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasOneOrMany.php#L143-L146
analogueorm/analogue
src/Relationships/HasOneOrMany.php
HasOneOrMany.matchOneOrMany
protected function matchOneOrMany(array $results, $relation, $type) { $entities = $this->getEager(); $dictionary = $this->buildDictionary($entities); $cache = $this->parentMapper->getEntityCache(); $host = $this; // Once we have the dictionary we can simply spin through t...
php
protected function matchOneOrMany(array $results, $relation, $type) { $entities = $this->getEager(); $dictionary = $this->buildDictionary($entities); $cache = $this->parentMapper->getEntityCache(); $host = $this; // Once we have the dictionary we can simply spin through t...
[ "protected", "function", "matchOneOrMany", "(", "array", "$", "results", ",", "$", "relation", ",", "$", "type", ")", "{", "$", "entities", "=", "$", "this", "->", "getEager", "(", ")", ";", "$", "dictionary", "=", "$", "this", "->", "buildDictionary", ...
Match the eagerly loaded results to their many parents. @param array $results @param string $relation @param string $type @return array
[ "Match", "the", "eagerly", "loaded", "results", "to", "their", "many", "parents", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasOneOrMany.php#L183-L212
analogueorm/analogue
src/Relationships/HasOneOrMany.php
HasOneOrMany.getRelationValue
protected function getRelationValue(array $dictionary, $key, $type) { $value = $dictionary[$key]; return $type == 'one' ? reset($value) : $this->relatedMap->newCollection($value); }
php
protected function getRelationValue(array $dictionary, $key, $type) { $value = $dictionary[$key]; return $type == 'one' ? reset($value) : $this->relatedMap->newCollection($value); }
[ "protected", "function", "getRelationValue", "(", "array", "$", "dictionary", ",", "$", "key", ",", "$", "type", ")", "{", "$", "value", "=", "$", "dictionary", "[", "$", "key", "]", ";", "return", "$", "type", "==", "'one'", "?", "reset", "(", "$", ...
Get the value of a relationship by one or many type. @param array $dictionary @param string $key @param string $type @return mixed
[ "Get", "the", "value", "of", "a", "relationship", "by", "one", "or", "many", "type", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasOneOrMany.php#L223-L228
analogueorm/analogue
src/Relationships/HasOneOrMany.php
HasOneOrMany.buildDictionary
protected function buildDictionary(EntityCollection $results) { $dictionary = []; $foreign = $this->getPlainForeignKey(); // First we will create a dictionary of models keyed by the foreign key of the // relationship as this will allow us to quickly access all of the related ...
php
protected function buildDictionary(EntityCollection $results) { $dictionary = []; $foreign = $this->getPlainForeignKey(); // First we will create a dictionary of models keyed by the foreign key of the // relationship as this will allow us to quickly access all of the related ...
[ "protected", "function", "buildDictionary", "(", "EntityCollection", "$", "results", ")", "{", "$", "dictionary", "=", "[", "]", ";", "$", "foreign", "=", "$", "this", "->", "getPlainForeignKey", "(", ")", ";", "// First we will create a dictionary of models keyed b...
Build model dictionary keyed by the relation's foreign key. @param EntityCollection $results @return array
[ "Build", "model", "dictionary", "keyed", "by", "the", "relation", "s", "foreign", "key", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasOneOrMany.php#L237-L251
analogueorm/analogue
src/Relationships/MorphPivot.php
MorphPivot.setKeysForSaveQuery
protected function setKeysForSaveQuery(Query $query) { $query->where($this->morphType, $this->morphClass); return parent::setKeysForSaveQuery($query); }
php
protected function setKeysForSaveQuery(Query $query) { $query->where($this->morphType, $this->morphClass); return parent::setKeysForSaveQuery($query); }
[ "protected", "function", "setKeysForSaveQuery", "(", "Query", "$", "query", ")", "{", "$", "query", "->", "where", "(", "$", "this", "->", "morphType", ",", "$", "this", "->", "morphClass", ")", ";", "return", "parent", "::", "setKeysForSaveQuery", "(", "$...
Set the keys for a save update query. @param Query $query @return Query
[ "Set", "the", "keys", "for", "a", "save", "update", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphPivot.php#L34-L39
analogueorm/analogue
src/Drivers/Manager.php
Manager.getAdapter
public function getAdapter(string $driver, string $connection = null) { if (array_key_exists($driver, $this->drivers)) { return $this->drivers[$driver]->getAdapter($connection); } }
php
public function getAdapter(string $driver, string $connection = null) { if (array_key_exists($driver, $this->drivers)) { return $this->drivers[$driver]->getAdapter($connection); } }
[ "public", "function", "getAdapter", "(", "string", "$", "driver", ",", "string", "$", "connection", "=", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "driver", ",", "$", "this", "->", "drivers", ")", ")", "{", "return", "$", "this", "->",...
Get the DBAdapter. @param string $driver @param string $connection connection name for drivers supporting multiple connection. @return DBAdapter
[ "Get", "the", "DBAdapter", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Drivers/Manager.php#L34-L39
analogueorm/analogue
src/AnalogueServiceProvider.php
AnalogueServiceProvider.register
public function register() { // Experimenting autoloading proxies $this->app->singleton('analogue', function ($app) { $db = $app['db']; $connectionProvider = new IlluminateConnectionProvider($db); $illuminate = new IlluminateDriver($connectionProvider); ...
php
public function register() { // Experimenting autoloading proxies $this->app->singleton('analogue', function ($app) { $db = $app['db']; $connectionProvider = new IlluminateConnectionProvider($db); $illuminate = new IlluminateDriver($connectionProvider); ...
[ "public", "function", "register", "(", ")", "{", "// Experimenting autoloading proxies", "$", "this", "->", "app", "->", "singleton", "(", "'analogue'", ",", "function", "(", "$", "app", ")", "{", "$", "db", "=", "$", "app", "[", "'db'", "]", ";", "$", ...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/AnalogueServiceProvider.php#L35-L82
analogueorm/analogue
src/System/Wrappers/Factory.php
Factory.make
public function make($object) { $manager = Manager::getInstance(); // Instantiate hydrator // TODO: We'll need to optimize this and allow pre-generation // of these hydrators, and get it, ideally, from the entityMap or // the Mapper class, so it's only instantiat...
php
public function make($object) { $manager = Manager::getInstance(); // Instantiate hydrator // TODO: We'll need to optimize this and allow pre-generation // of these hydrators, and get it, ideally, from the entityMap or // the Mapper class, so it's only instantiat...
[ "public", "function", "make", "(", "$", "object", ")", "{", "$", "manager", "=", "Manager", "::", "getInstance", "(", ")", ";", "// Instantiate hydrator", "// TODO: We'll need to optimize this and allow pre-generation", "// of these hydrators, and get it, ideally, from th...
Build the wrapper corresponding to the object's type. @param mixed $object @throws \Analogue\ORM\Exceptions\MappingException @return ObjectWrapper
[ "Build", "the", "wrapper", "corresponding", "to", "the", "object", "s", "type", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Wrappers/Factory.php#L19-L40
analogueorm/analogue
src/System/Builders/PolymorphicResultBuilder.php
PolymorphicResultBuilder.build
public function build(array $results, array $eagerLoads) { // Make a list of all primary key of the current result set. This will // allow us to group all polymorphic operations by type, then put // back every object in the intended order. $primaryKeyColumn = $this->entityMap->getKey...
php
public function build(array $results, array $eagerLoads) { // Make a list of all primary key of the current result set. This will // allow us to group all polymorphic operations by type, then put // back every object in the intended order. $primaryKeyColumn = $this->entityMap->getKey...
[ "public", "function", "build", "(", "array", "$", "results", ",", "array", "$", "eagerLoads", ")", "{", "// Make a list of all primary key of the current result set. This will", "// allow us to group all polymorphic operations by type, then put", "// back every object in the intended o...
Convert a result set into an array of entities. @param array $results @param array $eagerLoads name of the relation(s) to be eager loaded on the Entities @return array
[ "Convert", "a", "result", "set", "into", "an", "array", "of", "entities", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/PolymorphicResultBuilder.php#L65-L98
analogueorm/analogue
src/Drivers/IlluminateDBAdapter.php
IlluminateDBAdapter.getQuery
public function getQuery() { $connection = $this->connection; $grammar = $connection->getQueryGrammar(); return new IlluminateQueryBuilder($connection, $grammar, $connection->getPostProcessor()); }
php
public function getQuery() { $connection = $this->connection; $grammar = $connection->getQueryGrammar(); return new IlluminateQueryBuilder($connection, $grammar, $connection->getPostProcessor()); }
[ "public", "function", "getQuery", "(", ")", "{", "$", "connection", "=", "$", "this", "->", "connection", ";", "$", "grammar", "=", "$", "connection", "->", "getQueryGrammar", "(", ")", ";", "return", "new", "IlluminateQueryBuilder", "(", "$", "connection", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Drivers/IlluminateDBAdapter.php#L33-L40
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.getIdsFromHashes
protected function getIdsFromHashes(array $hashes) { $ids = []; foreach ($hashes as $hash) { $split = explode('.', $hash); $ids[] = $split[1]; } return $ids; }
php
protected function getIdsFromHashes(array $hashes) { $ids = []; foreach ($hashes as $hash) { $split = explode('.', $hash); $ids[] = $split[1]; } return $ids; }
[ "protected", "function", "getIdsFromHashes", "(", "array", "$", "hashes", ")", "{", "$", "ids", "=", "[", "]", ";", "foreach", "(", "$", "hashes", "as", "$", "hash", ")", "{", "$", "split", "=", "explode", "(", "'.'", ",", "$", "hash", ")", ";", ...
@param array $hashes @return array
[ "@param", "array", "$hashes" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L93-L103
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.wherePivot
public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') { return $this->where($this->table.'.'.$column, $operator, $value, $boolean); }
php
public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') { return $this->where($this->table.'.'.$column, $operator, $value, $boolean); }
[ "public", "function", "wherePivot", "(", "$", "column", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ",", "$", "boolean", "=", "'and'", ")", "{", "return", "$", "this", "->", "where", "(", "$", "this", "->", "table", ".", "'.'...
Set a where clause for a pivot table column. @param string $column @param string $operator @param mixed $value @param string $boolean @return self
[ "Set", "a", "where", "clause", "for", "a", "pivot", "table", "column", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L131-L134
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.get
public function get($columns = ['*']) : Collection { // First we'll add the proper select columns onto the query so it is run with // the proper columns. Then, we will get the results and hydrate out pivot // models with the result of those columns as a separate model relation. $colu...
php
public function get($columns = ['*']) : Collection { // First we'll add the proper select columns onto the query so it is run with // the proper columns. Then, we will get the results and hydrate out pivot // models with the result of those columns as a separate model relation. $colu...
[ "public", "function", "get", "(", "$", "columns", "=", "[", "'*'", "]", ")", ":", "Collection", "{", "// First we'll add the proper select columns onto the query so it is run with", "// the proper columns. Then, we will get the results and hydrate out pivot", "// models with the resu...
Execute the query as a "select" statement. @param array $columns @return \Illuminate\Support\Collection
[ "Execute", "the", "query", "as", "a", "select", "statement", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L199-L213
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.hydratePivotRelation
protected function hydratePivotRelation(array $entities) { // TODO (note) We should definitely get rid of the pivot in a next // release, as this is not quite relevant in a datamapper context. return array_map(function ($entity) { $entityWrapper = $this->factory->make($entity); ...
php
protected function hydratePivotRelation(array $entities) { // TODO (note) We should definitely get rid of the pivot in a next // release, as this is not quite relevant in a datamapper context. return array_map(function ($entity) { $entityWrapper = $this->factory->make($entity); ...
[ "protected", "function", "hydratePivotRelation", "(", "array", "$", "entities", ")", "{", "// TODO (note) We should definitely get rid of the pivot in a next", "// release, as this is not quite relevant in a datamapper context.", "return", "array_map", "(", "function", "(", "$", "e...
Hydrate the pivot table relationship on the models. @param array $entities @return array
[ "Hydrate", "the", "pivot", "table", "relationship", "on", "the", "models", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L222-L237
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.cleanPivotAttributes
protected function cleanPivotAttributes(InternallyMappable $entity) { $values = []; $attributes = $entity->getEntityAttributes(); foreach ($attributes as $key => $value) { // To get the pivots attributes we will just take any of the attributes which // begin with "p...
php
protected function cleanPivotAttributes(InternallyMappable $entity) { $values = []; $attributes = $entity->getEntityAttributes(); foreach ($attributes as $key => $value) { // To get the pivots attributes we will just take any of the attributes which // begin with "p...
[ "protected", "function", "cleanPivotAttributes", "(", "InternallyMappable", "$", "entity", ")", "{", "$", "values", "=", "[", "]", ";", "$", "attributes", "=", "$", "entity", "->", "getEntityAttributes", "(", ")", ";", "foreach", "(", "$", "attributes", "as"...
Get the pivot attributes from a model. @param InternallyMappable $entity @return array
[ "Get", "the", "pivot", "attributes", "from", "a", "model", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L246-L267
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.getRelationCountQuery
public function getRelationCountQuery(Query $query, Query $parent) { if ($parent->getQuery()->from == $query->getQuery()->from) { return $this->getRelationCountQueryForSelfJoin($query, $parent); } $this->setJoin($query); return parent::getRelationCountQuery($query, $par...
php
public function getRelationCountQuery(Query $query, Query $parent) { if ($parent->getQuery()->from == $query->getQuery()->from) { return $this->getRelationCountQueryForSelfJoin($query, $parent); } $this->setJoin($query); return parent::getRelationCountQuery($query, $par...
[ "public", "function", "getRelationCountQuery", "(", "Query", "$", "query", ",", "Query", "$", "parent", ")", "{", "if", "(", "$", "parent", "->", "getQuery", "(", ")", "->", "from", "==", "$", "query", "->", "getQuery", "(", ")", "->", "from", ")", "...
Add the constraints for a relationship count query. @param Query $query @param Query $parent @return Query
[ "Add", "the", "constraints", "for", "a", "relationship", "count", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L291-L300
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.getSelectColumns
protected function getSelectColumns(array $columns = ['*']) { if ($columns == ['*']) { $columns = [$this->relatedMap->getTable().'.*']; } return array_merge($columns, $this->getAliasedPivotColumns()); }
php
protected function getSelectColumns(array $columns = ['*']) { if ($columns == ['*']) { $columns = [$this->relatedMap->getTable().'.*']; } return array_merge($columns, $this->getAliasedPivotColumns()); }
[ "protected", "function", "getSelectColumns", "(", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "$", "columns", "==", "[", "'*'", "]", ")", "{", "$", "columns", "=", "[", "$", "this", "->", "relatedMap", "->", "getTable", "(", ...
Set the select clause for the relation query. @param array $columns @return \Analogue\ORM\Relationships\BelongsToMany
[ "Set", "the", "select", "clause", "for", "the", "relation", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L340-L347
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.setWhere
protected function setWhere() { $foreign = $this->getForeignKey(); $parentKey = $this->parentMap->getKeyName(); $this->query->where($foreign, '=', $this->parent->getEntityAttribute($parentKey)); return $this; }
php
protected function setWhere() { $foreign = $this->getForeignKey(); $parentKey = $this->parentMap->getKeyName(); $this->query->where($foreign, '=', $this->parent->getEntityAttribute($parentKey)); return $this; }
[ "protected", "function", "setWhere", "(", ")", "{", "$", "foreign", "=", "$", "this", "->", "getForeignKey", "(", ")", ";", "$", "parentKey", "=", "$", "this", "->", "parentMap", "->", "getKeyName", "(", ")", ";", "$", "this", "->", "query", "->", "w...
Set the where clause for the relation query. @return $this
[ "Set", "the", "where", "clause", "for", "the", "relation", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L398-L407
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.addEagerConstraints
public function addEagerConstraints(array $results) { $this->query->whereIn($this->getForeignKey(), $this->getKeysFromResults($results)); }
php
public function addEagerConstraints(array $results) { $this->query->whereIn($this->getForeignKey(), $this->getKeysFromResults($results)); }
[ "public", "function", "addEagerConstraints", "(", "array", "$", "results", ")", "{", "$", "this", "->", "query", "->", "whereIn", "(", "$", "this", "->", "getForeignKey", "(", ")", ",", "$", "this", "->", "getKeysFromResults", "(", "$", "results", ")", "...
Set the constraints for an eager load of the relation. @param array $results @return void
[ "Set", "the", "constraints", "for", "an", "eager", "load", "of", "the", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L416-L419
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.match
public function match(array $results, $relation) { $entities = $this->getEager(); // TODO; optimize this operation $dictionary = $this->buildDictionary($entities); $keyName = $this->parentMap->getKeyName(); $cache = $this->parentMapper->getEntityCache(); $host = $...
php
public function match(array $results, $relation) { $entities = $this->getEager(); // TODO; optimize this operation $dictionary = $this->buildDictionary($entities); $keyName = $this->parentMap->getKeyName(); $cache = $this->parentMapper->getEntityCache(); $host = $...
[ "public", "function", "match", "(", "array", "$", "results", ",", "$", "relation", ")", "{", "$", "entities", "=", "$", "this", "->", "getEager", "(", ")", ";", "// TODO; optimize this operation", "$", "dictionary", "=", "$", "this", "->", "buildDictionary",...
Match Eagerly loaded relation to result. @param array $results @param string $relation @return array
[ "Match", "Eagerly", "loaded", "relation", "to", "result", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L429-L461
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.buildDictionary
protected function buildDictionary(EntityCollection $results) { $foreign = $this->foreignKey; // First we will build a dictionary of child models keyed by the foreign key // of the relation so that we will easily and quickly match them to their // parents without having a possibly s...
php
protected function buildDictionary(EntityCollection $results) { $foreign = $this->foreignKey; // First we will build a dictionary of child models keyed by the foreign key // of the relation so that we will easily and quickly match them to their // parents without having a possibly s...
[ "protected", "function", "buildDictionary", "(", "EntityCollection", "$", "results", ")", "{", "$", "foreign", "=", "$", "this", "->", "foreignKey", ";", "// First we will build a dictionary of child models keyed by the foreign key", "// of the relation so that we will easily and...
Build model dictionary keyed by the relation's foreign key. @param EntityCollection $results @return array
[ "Build", "model", "dictionary", "keyed", "by", "the", "relation", "s", "foreign", "key", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L470-L488
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.getRelatedIds
public function getRelatedIds() { $fullKey = $this->relatedMap->getQualifiedKeyName(); return $this->getQuery()->select($fullKey)->lists($this->relatedMap->getKeyName()); }
php
public function getRelatedIds() { $fullKey = $this->relatedMap->getQualifiedKeyName(); return $this->getQuery()->select($fullKey)->lists($this->relatedMap->getKeyName()); }
[ "public", "function", "getRelatedIds", "(", ")", "{", "$", "fullKey", "=", "$", "this", "->", "relatedMap", "->", "getQualifiedKeyName", "(", ")", ";", "return", "$", "this", "->", "getQuery", "(", ")", "->", "select", "(", "$", "fullKey", ")", "->", "...
Get all of the IDs for the related models. @return array
[ "Get", "all", "of", "the", "IDs", "for", "the", "related", "models", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L495-L500
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.updatePivot
public function updatePivot($entity) { $keyName = $this->relatedMap->getKeyName(); $this->updateExistingPivot( $entity->getEntityAttribute($keyName), $entity->getEntityAttribute('pivot')->getEntityAttributes() ); }
php
public function updatePivot($entity) { $keyName = $this->relatedMap->getKeyName(); $this->updateExistingPivot( $entity->getEntityAttribute($keyName), $entity->getEntityAttribute('pivot')->getEntityAttributes() ); }
[ "public", "function", "updatePivot", "(", "$", "entity", ")", "{", "$", "keyName", "=", "$", "this", "->", "relatedMap", "->", "getKeyName", "(", ")", ";", "$", "this", "->", "updateExistingPivot", "(", "$", "entity", "->", "getEntityAttribute", "(", "$", ...
Update Pivot. @param \Analogue\ORM\Entity $entity @return void
[ "Update", "Pivot", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L509-L517
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.createPivots
public function createPivots($relatedEntities) { $keys = []; $attributes = []; $keyName = $this->relatedMap->getKeyName(); foreach ($relatedEntities as $entity) { $keys[] = $entity->getEntityAttribute($keyName); } $records = $this->createAttachRecords($...
php
public function createPivots($relatedEntities) { $keys = []; $attributes = []; $keyName = $this->relatedMap->getKeyName(); foreach ($relatedEntities as $entity) { $keys[] = $entity->getEntityAttribute($keyName); } $records = $this->createAttachRecords($...
[ "public", "function", "createPivots", "(", "$", "relatedEntities", ")", "{", "$", "keys", "=", "[", "]", ";", "$", "attributes", "=", "[", "]", ";", "$", "keyName", "=", "$", "this", "->", "relatedMap", "->", "getKeyName", "(", ")", ";", "foreach", "...
Create Pivot Records. @param \Analogue\ORM\Entity[] $relatedEntities @return void
[ "Create", "Pivot", "Records", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L540-L554
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.attach
public function attach($id, array $attributes = []) { $query = $this->newPivotStatement(); $query->insert($this->createAttachRecords((array) $id, $attributes)); }
php
public function attach($id, array $attributes = []) { $query = $this->newPivotStatement(); $query->insert($this->createAttachRecords((array) $id, $attributes)); }
[ "public", "function", "attach", "(", "$", "id", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "newPivotStatement", "(", ")", ";", "$", "query", "->", "insert", "(", "$", "this", "->", "createAttachRec...
Attach a model to the parent. @param mixed $id @param array $attributes @return void
[ "Attach", "a", "model", "to", "the", "parent", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L583-L588
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.detachExcept
protected function detachExcept(array $entities = []) { $query = $this->newPivotQuery(); if (count($entities) > 0) { $keys = $this->getKeys($entities); $query->whereNotIn($this->otherKey, $keys); } $parentKey = $this->parentMap->getKeyName(); $query...
php
protected function detachExcept(array $entities = []) { $query = $this->newPivotQuery(); if (count($entities) > 0) { $keys = $this->getKeys($entities); $query->whereNotIn($this->otherKey, $keys); } $parentKey = $this->parentMap->getKeyName(); $query...
[ "protected", "function", "detachExcept", "(", "array", "$", "entities", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "newPivotQuery", "(", ")", ";", "if", "(", "count", "(", "$", "entities", ")", ">", "0", ")", "{", "$", "keys", ...
Detach related entities that are not in $id. @param array $entities @throws \InvalidArgumentException @return void
[ "Detach", "related", "entities", "that", "are", "not", "in", "$id", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L609-L623
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.createAttachRecords
protected function createAttachRecords($ids, array $attributes) { $records = []; $timed = in_array($this->createdAt(), $this->pivotColumns); // To create the attachment records, we will simply spin through the IDs given // and create a new record to insert for each ID. Each ID may ...
php
protected function createAttachRecords($ids, array $attributes) { $records = []; $timed = in_array($this->createdAt(), $this->pivotColumns); // To create the attachment records, we will simply spin through the IDs given // and create a new record to insert for each ID. Each ID may ...
[ "protected", "function", "createAttachRecords", "(", "$", "ids", ",", "array", "$", "attributes", ")", "{", "$", "records", "=", "[", "]", ";", "$", "timed", "=", "in_array", "(", "$", "this", "->", "createdAt", "(", ")", ",", "$", "this", "->", "piv...
Create an array of records to insert into the pivot table. @param array $ids @param array $attributes @return array
[ "Create", "an", "array", "of", "records", "to", "insert", "into", "the", "pivot", "table", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L633-L647
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.attacher
protected function attacher($key, $value, $attributes, $timed) { list($id, $extra) = $this->getAttachId($key, $value, $attributes); // To create the attachment records, we will simply spin through the IDs given // and create a new record to insert for each ID. Each ID may actually be a ...
php
protected function attacher($key, $value, $attributes, $timed) { list($id, $extra) = $this->getAttachId($key, $value, $attributes); // To create the attachment records, we will simply spin through the IDs given // and create a new record to insert for each ID. Each ID may actually be a ...
[ "protected", "function", "attacher", "(", "$", "key", ",", "$", "value", ",", "$", "attributes", ",", "$", "timed", ")", "{", "list", "(", "$", "id", ",", "$", "extra", ")", "=", "$", "this", "->", "getAttachId", "(", "$", "key", ",", "$", "value...
Create a full attachment record payload. @param int $key @param mixed $value @param array $attributes @param bool $timed @return array
[ "Create", "a", "full", "attachment", "record", "payload", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L659-L669
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.createAttachRecord
protected function createAttachRecord($id, $timed) { $parentKey = $this->parentMap->getKeyName(); $record = []; $record[$this->foreignKey] = $this->parent->getEntityAttribute($parentKey); $record[$this->otherKey] = $id; // If the record needs to have creation and update t...
php
protected function createAttachRecord($id, $timed) { $parentKey = $this->parentMap->getKeyName(); $record = []; $record[$this->foreignKey] = $this->parent->getEntityAttribute($parentKey); $record[$this->otherKey] = $id; // If the record needs to have creation and update t...
[ "protected", "function", "createAttachRecord", "(", "$", "id", ",", "$", "timed", ")", "{", "$", "parentKey", "=", "$", "this", "->", "parentMap", "->", "getKeyName", "(", ")", ";", "$", "record", "=", "[", "]", ";", "$", "record", "[", "$", "this", ...
Create a new pivot attachment record. @param int $id @param bool $timed @return array
[ "Create", "a", "new", "pivot", "attachment", "record", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L697-L715
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.getModelKeysFromCollection
protected function getModelKeysFromCollection(EntityCollection $entities) { $keyName = $this->relatedMap->getKeyName(); return array_map(function ($m) use ($keyName) { return $m->$keyName; }, $entities); }
php
protected function getModelKeysFromCollection(EntityCollection $entities) { $keyName = $this->relatedMap->getKeyName(); return array_map(function ($m) use ($keyName) { return $m->$keyName; }, $entities); }
[ "protected", "function", "getModelKeysFromCollection", "(", "EntityCollection", "$", "entities", ")", "{", "$", "keyName", "=", "$", "this", "->", "relatedMap", "->", "getKeyName", "(", ")", ";", "return", "array_map", "(", "function", "(", "$", "m", ")", "u...
@param EntityCollection $entities @return array
[ "@param", "EntityCollection", "$entities" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L743-L750
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.detach
public function detach($ids = []) { if ($ids instanceof EntityCollection) { $ids = (array) $ids->modelKeys(); } $query = $this->newPivotQuery(); // If associated IDs were passed to the method we will only delete those // associations, otherwise all of the associ...
php
public function detach($ids = []) { if ($ids instanceof EntityCollection) { $ids = (array) $ids->modelKeys(); } $query = $this->newPivotQuery(); // If associated IDs were passed to the method we will only delete those // associations, otherwise all of the associ...
[ "public", "function", "detach", "(", "$", "ids", "=", "[", "]", ")", "{", "if", "(", "$", "ids", "instanceof", "EntityCollection", ")", "{", "$", "ids", "=", "(", "array", ")", "$", "ids", "->", "modelKeys", "(", ")", ";", "}", "$", "query", "=",...
Detach models from the relationship. @param int|array $ids @throws \InvalidArgumentException @return int
[ "Detach", "models", "from", "the", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L761-L782
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.newPivotQuery
protected function newPivotQuery() { $query = $this->newPivotStatement(); $parentKey = $this->parentMap->getKeyName(); return $query->where($this->foreignKey, $this->parent->getEntityAttribute($parentKey)); }
php
protected function newPivotQuery() { $query = $this->newPivotStatement(); $parentKey = $this->parentMap->getKeyName(); return $query->where($this->foreignKey, $this->parent->getEntityAttribute($parentKey)); }
[ "protected", "function", "newPivotQuery", "(", ")", "{", "$", "query", "=", "$", "this", "->", "newPivotStatement", "(", ")", ";", "$", "parentKey", "=", "$", "this", "->", "parentMap", "->", "getKeyName", "(", ")", ";", "return", "$", "query", "->", "...
Create a new query builder for the pivot table. @throws \InvalidArgumentException @return \Illuminate\Database\Query\Builder
[ "Create", "a", "new", "query", "builder", "for", "the", "pivot", "table", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L791-L798
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.newPivotStatementForId
public function newPivotStatementForId($id) { $pivot = $this->newPivotStatement(); $parentKeyName = $this->parentMap->getKeyName(); $key = $this->parent->getEntityAttribute($parentKeyName); return $pivot->where($this->foreignKey, $key)->where($this->otherKey, $id); }
php
public function newPivotStatementForId($id) { $pivot = $this->newPivotStatement(); $parentKeyName = $this->parentMap->getKeyName(); $key = $this->parent->getEntityAttribute($parentKeyName); return $pivot->where($this->foreignKey, $key)->where($this->otherKey, $id); }
[ "public", "function", "newPivotStatementForId", "(", "$", "id", ")", "{", "$", "pivot", "=", "$", "this", "->", "newPivotStatement", "(", ")", ";", "$", "parentKeyName", "=", "$", "this", "->", "parentMap", "->", "getKeyName", "(", ")", ";", "$", "key", ...
Get a new pivot statement for a given "other" ID. @param mixed $id @throws \InvalidArgumentException @return \Illuminate\Database\Query\Builder
[ "Get", "a", "new", "pivot", "statement", "for", "a", "given", "other", "ID", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L819-L828
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.newPivot
public function newPivot(array $attributes = [], $exists = false) { $pivot = new Pivot($this->parent, $this->parentMap, $attributes, $this->table, $exists); return $pivot->setPivotKeys($this->foreignKey, $this->otherKey); }
php
public function newPivot(array $attributes = [], $exists = false) { $pivot = new Pivot($this->parent, $this->parentMap, $attributes, $this->table, $exists); return $pivot->setPivotKeys($this->foreignKey, $this->otherKey); }
[ "public", "function", "newPivot", "(", "array", "$", "attributes", "=", "[", "]", ",", "$", "exists", "=", "false", ")", "{", "$", "pivot", "=", "new", "Pivot", "(", "$", "this", "->", "parent", ",", "$", "this", "->", "parentMap", ",", "$", "attri...
Create a new pivot model instance. @param array $attributes @param bool $exists @return \Analogue\ORM\Relationships\Pivot
[ "Create", "a", "new", "pivot", "model", "instance", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L838-L843
analogueorm/analogue
src/Relationships/BelongsToMany.php
BelongsToMany.withTimestamps
public function withTimestamps($createdAt = null, $updatedAt = null) { return $this->withPivot($createdAt ?: $this->createdAt(), $updatedAt ?: $this->updatedAt()); }
php
public function withTimestamps($createdAt = null, $updatedAt = null) { return $this->withPivot($createdAt ?: $this->createdAt(), $updatedAt ?: $this->updatedAt()); }
[ "public", "function", "withTimestamps", "(", "$", "createdAt", "=", "null", ",", "$", "updatedAt", "=", "null", ")", "{", "return", "$", "this", "->", "withPivot", "(", "$", "createdAt", "?", ":", "$", "this", "->", "createdAt", "(", ")", ",", "$", "...
Specify that the pivot table has creation and update timestamps. @param mixed $createdAt @param mixed $updatedAt @return \Analogue\ORM\Relationships\BelongsToMany
[ "Specify", "that", "the", "pivot", "table", "has", "creation", "and", "update", "timestamps", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsToMany.php#L881-L884
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.matchSingleResult
public function matchSingleResult(array $attributes) : array { return $this->asArray ? $this->matchAsArray($attributes) : $this->matchAsAttributes($attributes); }
php
public function matchSingleResult(array $attributes) : array { return $this->asArray ? $this->matchAsArray($attributes) : $this->matchAsAttributes($attributes); }
[ "public", "function", "matchSingleResult", "(", "array", "$", "attributes", ")", ":", "array", "{", "return", "$", "this", "->", "asArray", "?", "$", "this", "->", "matchAsArray", "(", "$", "attributes", ")", ":", "$", "this", "->", "matchAsAttributes", "(...
Match a single database row's attributes to a single object, and return the updated attributes. @param array $attributes @return array
[ "Match", "a", "single", "database", "row", "s", "attributes", "to", "a", "single", "object", "and", "return", "the", "updated", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L37-L40
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.matchAsArray
protected function matchAsArray(array $attributes) : array { // Extract the attributes with the key of the relation, // which should be an array. $key = $this->relation; if (!array_key_exists($key, $attributes) && !is_array($key)) { throw new MappingException("'$key' col...
php
protected function matchAsArray(array $attributes) : array { // Extract the attributes with the key of the relation, // which should be an array. $key = $this->relation; if (!array_key_exists($key, $attributes) && !is_array($key)) { throw new MappingException("'$key' col...
[ "protected", "function", "matchAsArray", "(", "array", "$", "attributes", ")", ":", "array", "{", "// Extract the attributes with the key of the relation,", "// which should be an array.", "$", "key", "=", "$", "this", "->", "relation", ";", "if", "(", "!", "array_key...
Match array attribute from parent to an embedded object, and return the updated attributes. @param array $attributes @throws MappingException @return array
[ "Match", "array", "attribute", "from", "parent", "to", "an", "embedded", "object", "and", "return", "the", "updated", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L52-L69
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.matchAsAttributes
protected function matchAsAttributes(array $attributes) : array { $attributesMap = $this->getAttributesDictionnary(); // Get the subset that only the embedded object is concerned with and, convert it back // to embedded object attributes keys $originalAttributes = array_only($attrib...
php
protected function matchAsAttributes(array $attributes) : array { $attributesMap = $this->getAttributesDictionnary(); // Get the subset that only the embedded object is concerned with and, convert it back // to embedded object attributes keys $originalAttributes = array_only($attrib...
[ "protected", "function", "matchAsAttributes", "(", "array", "$", "attributes", ")", ":", "array", "{", "$", "attributesMap", "=", "$", "this", "->", "getAttributesDictionnary", "(", ")", ";", "// Get the subset that only the embedded object is concerned with and, convert it...
Transform attributes from the parent entity result into an embedded object, and return the updated attributes. @param array $attributes @return array
[ "Transform", "attributes", "from", "the", "parent", "entity", "result", "into", "an", "embedded", "object", "and", "return", "the", "updated", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L79-L104
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.getAttributesDictionnary
protected function getAttributesDictionnary() : array { // Get attributes that belongs to the embedded object $embeddedAttributeKeys = $this->getEmbeddedObjectAttributes(); $attributesMap = []; // Build a dictionary for corresponding object attributes => parent attributes f...
php
protected function getAttributesDictionnary() : array { // Get attributes that belongs to the embedded object $embeddedAttributeKeys = $this->getEmbeddedObjectAttributes(); $attributesMap = []; // Build a dictionary for corresponding object attributes => parent attributes f...
[ "protected", "function", "getAttributesDictionnary", "(", ")", ":", "array", "{", "// Get attributes that belongs to the embedded object", "$", "embeddedAttributeKeys", "=", "$", "this", "->", "getEmbeddedObjectAttributes", "(", ")", ";", "$", "attributesMap", "=", "[", ...
Return a dictionary of attributes key on parent Entity. @return array
[ "Return", "a", "dictionary", "of", "attributes", "key", "on", "parent", "Entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L111-L124
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.normalize
public function normalize($object) : array { return $this->asArray ? $this->normalizeAsArray($object) : $this->normalizeAsAttributes($object); }
php
public function normalize($object) : array { return $this->asArray ? $this->normalizeAsArray($object) : $this->normalizeAsAttributes($object); }
[ "public", "function", "normalize", "(", "$", "object", ")", ":", "array", "{", "return", "$", "this", "->", "asArray", "?", "$", "this", "->", "normalizeAsArray", "(", "$", "object", ")", ":", "$", "this", "->", "normalizeAsAttributes", "(", "$", "object...
Transform embedded object into DB column(s). @param mixed $object @return array $columns
[ "Transform", "embedded", "object", "into", "DB", "column", "(", "s", ")", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L133-L136
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.normalizeAsArray
protected function normalizeAsArray($object) : array { $wrapper = $this->factory->make($object); $value = $wrapper->getEntityAttributes(); if ($this->asJson) { $value = json_encode($value); } return [$this->relation => $value]; }
php
protected function normalizeAsArray($object) : array { $wrapper = $this->factory->make($object); $value = $wrapper->getEntityAttributes(); if ($this->asJson) { $value = json_encode($value); } return [$this->relation => $value]; }
[ "protected", "function", "normalizeAsArray", "(", "$", "object", ")", ":", "array", "{", "$", "wrapper", "=", "$", "this", "->", "factory", "->", "make", "(", "$", "object", ")", ";", "$", "value", "=", "$", "wrapper", "->", "getEntityAttributes", "(", ...
Normalize object an array containing raw attributes. @param mixed $object @return array
[ "Normalize", "object", "an", "array", "containing", "raw", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L145-L156
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.normalizeAsAttributes
protected function normalizeAsAttributes($object) : array { if (is_null($object)) { return $this->nullObjectAttributes(); } $attributesMap = $this->getAttributesDictionnary(); $wrapper = $this->factory->make($object); $normalizedAttributes = []; foreac...
php
protected function normalizeAsAttributes($object) : array { if (is_null($object)) { return $this->nullObjectAttributes(); } $attributesMap = $this->getAttributesDictionnary(); $wrapper = $this->factory->make($object); $normalizedAttributes = []; foreac...
[ "protected", "function", "normalizeAsAttributes", "(", "$", "object", ")", ":", "array", "{", "if", "(", "is_null", "(", "$", "object", ")", ")", "{", "return", "$", "this", "->", "nullObjectAttributes", "(", ")", ";", "}", "$", "attributesMap", "=", "$"...
Normalize object as parent's attributes. @param mixed $object @return array
[ "Normalize", "object", "as", "parent", "s", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L165-L182
analogueorm/analogue
src/Relationships/EmbedsOne.php
EmbedsOne.nullObjectAttributes
protected function nullObjectAttributes() : array { $attributesMap = $this->getAttributesDictionnary(); $normalizedAttributes = []; foreach ($attributesMap as $embedKey => $parentKey) { $normalizedAttributes[$parentKey] = null; } return $normalizedAttributes; ...
php
protected function nullObjectAttributes() : array { $attributesMap = $this->getAttributesDictionnary(); $normalizedAttributes = []; foreach ($attributesMap as $embedKey => $parentKey) { $normalizedAttributes[$parentKey] = null; } return $normalizedAttributes; ...
[ "protected", "function", "nullObjectAttributes", "(", ")", ":", "array", "{", "$", "attributesMap", "=", "$", "this", "->", "getAttributesDictionnary", "(", ")", ";", "$", "normalizedAttributes", "=", "[", "]", ";", "foreach", "(", "$", "attributesMap", "as", ...
Set all object attributes to null. @return array
[ "Set", "all", "object", "attributes", "to", "null", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsOne.php#L189-L200
analogueorm/analogue
src/Commands/Store.php
Store.execute
public function execute() { $entity = $this->aggregate->getEntityObject(); $wrappedEntity = $this->aggregate->getWrappedEntity(); $mapper = $this->aggregate->getMapper(); if ($mapper->fireEvent('storing', $wrappedEntity) === false) { return false; } $thi...
php
public function execute() { $entity = $this->aggregate->getEntityObject(); $wrappedEntity = $this->aggregate->getWrappedEntity(); $mapper = $this->aggregate->getMapper(); if ($mapper->fireEvent('storing', $wrappedEntity) === false) { return false; } $thi...
[ "public", "function", "execute", "(", ")", "{", "$", "entity", "=", "$", "this", "->", "aggregate", "->", "getEntityObject", "(", ")", ";", "$", "wrappedEntity", "=", "$", "this", "->", "aggregate", "->", "getWrappedEntity", "(", ")", ";", "$", "mapper",...
Persist the entity in the database. @throws \InvalidArgumentException @return false|mixed
[ "Persist", "the", "entity", "in", "the", "database", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L20-L69
analogueorm/analogue
src/Commands/Store.php
Store.preStoreProcess
protected function preStoreProcess() { // Create any related object that doesn't exist in the database. $localRelationships = $this->aggregate->getEntityMap()->getLocalRelationships(); $this->createRelatedEntities($localRelationships); // Now we can sync the related collections ...
php
protected function preStoreProcess() { // Create any related object that doesn't exist in the database. $localRelationships = $this->aggregate->getEntityMap()->getLocalRelationships(); $this->createRelatedEntities($localRelationships); // Now we can sync the related collections ...
[ "protected", "function", "preStoreProcess", "(", ")", "{", "// Create any related object that doesn't exist in the database.", "$", "localRelationships", "=", "$", "this", "->", "aggregate", "->", "getEntityMap", "(", ")", "->", "getLocalRelationships", "(", ")", ";", "...
Run all operations that have to occur before actually storing the entity. @throws \InvalidArgumentException @return void
[ "Run", "all", "operations", "that", "have", "to", "occur", "before", "actually", "storing", "the", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L79-L88
analogueorm/analogue
src/Commands/Store.php
Store.createRelatedEntities
protected function createRelatedEntities($relations) { $entitiesToCreate = $this->aggregate->getNonExistingRelated($relations); foreach ($entitiesToCreate as $aggregate) { $this->createStoreCommand($aggregate)->execute(); } }
php
protected function createRelatedEntities($relations) { $entitiesToCreate = $this->aggregate->getNonExistingRelated($relations); foreach ($entitiesToCreate as $aggregate) { $this->createStoreCommand($aggregate)->execute(); } }
[ "protected", "function", "createRelatedEntities", "(", "$", "relations", ")", "{", "$", "entitiesToCreate", "=", "$", "this", "->", "aggregate", "->", "getNonExistingRelated", "(", "$", "relations", ")", ";", "foreach", "(", "$", "entitiesToCreate", "as", "$", ...
Check for existence and create non-existing related entities. @param array @throws \InvalidArgumentException @return void
[ "Check", "for", "existence", "and", "create", "non", "-", "existing", "related", "entities", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L99-L106
analogueorm/analogue
src/Commands/Store.php
Store.createStoreCommand
protected function createStoreCommand(Aggregate $aggregate): self { // We gotta retrieve the corresponding query adapter to use. $mapper = $aggregate->getMapper(); return new self($aggregate, $mapper->newQueryBuilder()); }
php
protected function createStoreCommand(Aggregate $aggregate): self { // We gotta retrieve the corresponding query adapter to use. $mapper = $aggregate->getMapper(); return new self($aggregate, $mapper->newQueryBuilder()); }
[ "protected", "function", "createStoreCommand", "(", "Aggregate", "$", "aggregate", ")", ":", "self", "{", "// We gotta retrieve the corresponding query adapter to use.", "$", "mapper", "=", "$", "aggregate", "->", "getMapper", "(", ")", ";", "return", "new", "self", ...
Create a new store command. @param Aggregate $aggregate @return Store
[ "Create", "a", "new", "store", "command", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L115-L121
analogueorm/analogue
src/Commands/Store.php
Store.postStoreProcess
protected function postStoreProcess() { $aggregate = $this->aggregate; // Create any related object that doesn't exist in the database. $foreignRelationships = $aggregate->getEntityMap()->getForeignRelationships(); $this->createRelatedEntities($foreignRelationships); // Up...
php
protected function postStoreProcess() { $aggregate = $this->aggregate; // Create any related object that doesn't exist in the database. $foreignRelationships = $aggregate->getEntityMap()->getForeignRelationships(); $this->createRelatedEntities($foreignRelationships); // Up...
[ "protected", "function", "postStoreProcess", "(", ")", "{", "$", "aggregate", "=", "$", "this", "->", "aggregate", ";", "// Create any related object that doesn't exist in the database.", "$", "foreignRelationships", "=", "$", "aggregate", "->", "getEntityMap", "(", ")"...
Run all operations that have to occur after the entity is stored. @throws \InvalidArgumentException @return void
[ "Run", "all", "operations", "that", "have", "to", "occur", "after", "the", "entity", "is", "stored", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L131-L165
analogueorm/analogue
src/Commands/Store.php
Store.insert
protected function insert() { $aggregate = $this->aggregate; $attributes = $aggregate->getRawAttributes(); $keyName = $aggregate->getEntityMap()->getKeyName(); // Check if the primary key is defined in the attributes if (array_key_exists($keyName, $attributes) && $attribut...
php
protected function insert() { $aggregate = $this->aggregate; $attributes = $aggregate->getRawAttributes(); $keyName = $aggregate->getEntityMap()->getKeyName(); // Check if the primary key is defined in the attributes if (array_key_exists($keyName, $attributes) && $attribut...
[ "protected", "function", "insert", "(", ")", "{", "$", "aggregate", "=", "$", "this", "->", "aggregate", ";", "$", "attributes", "=", "$", "aggregate", "->", "getRawAttributes", "(", ")", ";", "$", "keyName", "=", "$", "aggregate", "->", "getEntityMap", ...
Execute an insert statement on the database. @return void
[ "Execute", "an", "insert", "statement", "on", "the", "database", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L172-L197
analogueorm/analogue
src/Commands/Store.php
Store.syncForeignKeyAttributes
protected function syncForeignKeyAttributes() { $attributes = $this->aggregate->getForeignKeyAttributes(); foreach ($attributes as $key => $value) { $this->aggregate->setEntityAttribute($key, $value); } }
php
protected function syncForeignKeyAttributes() { $attributes = $this->aggregate->getForeignKeyAttributes(); foreach ($attributes as $key => $value) { $this->aggregate->setEntityAttribute($key, $value); } }
[ "protected", "function", "syncForeignKeyAttributes", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "aggregate", "->", "getForeignKeyAttributes", "(", ")", ";", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "...
Update attributes on actual entity. @param array $attributes @return void
[ "Update", "attributes", "on", "actual", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L206-L213
analogueorm/analogue
src/Commands/Store.php
Store.update
protected function update() { $key = $this->aggregate->getEntityKeyName(); $value = $this->aggregate->getEntityKeyValue(); $this->query->where($key, $value); $dirtyAttributes = $this->aggregate->getDirtyRawAttributes(); if (count($dirtyAttributes) > 0) { $this-...
php
protected function update() { $key = $this->aggregate->getEntityKeyName(); $value = $this->aggregate->getEntityKeyValue(); $this->query->where($key, $value); $dirtyAttributes = $this->aggregate->getDirtyRawAttributes(); if (count($dirtyAttributes) > 0) { $this-...
[ "protected", "function", "update", "(", ")", "{", "$", "key", "=", "$", "this", "->", "aggregate", "->", "getEntityKeyName", "(", ")", ";", "$", "value", "=", "$", "this", "->", "aggregate", "->", "getEntityKeyValue", "(", ")", ";", "$", "this", "->", ...
Run an update statement on the entity. @throws \InvalidArgumentException @return void
[ "Run", "an", "update", "statement", "on", "the", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Store.php#L222-L234
analogueorm/analogue
src/System/Cache/InstanceCache.php
InstanceCache.add
public function add($entity, string $id) { $entityClass = get_class($entity); if ($entityClass !== $this->class) { throw new CacheException('Tried to cache an instance with a wrong type : expected '.$this->class.", got $entityClass"); } // Cache once and ignore subseque...
php
public function add($entity, string $id) { $entityClass = get_class($entity); if ($entityClass !== $this->class) { throw new CacheException('Tried to cache an instance with a wrong type : expected '.$this->class.", got $entityClass"); } // Cache once and ignore subseque...
[ "public", "function", "add", "(", "$", "entity", ",", "string", "$", "id", ")", "{", "$", "entityClass", "=", "get_class", "(", "$", "entity", ")", ";", "if", "(", "$", "entityClass", "!==", "$", "this", "->", "class", ")", "{", "throw", "new", "Ca...
Add an entity to the cache. @param mixed $entity @param string $id @throws CacheException @return void
[ "Add", "an", "entity", "to", "the", "cache", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/InstanceCache.php#L43-L56
analogueorm/analogue
src/Plugins/SoftDeletes/SoftDeletesPlugin.php
SoftDeletesPlugin.register
public function register() { // Hook any mapper init and check the mapping include soft deletes. $this->manager->registerGlobalEvent('initialized', function ($event, $payload = null) { // Cross Compatible Event handling with 5.3 // TODO : find a replacement event handler ...
php
public function register() { // Hook any mapper init and check the mapping include soft deletes. $this->manager->registerGlobalEvent('initialized', function ($event, $payload = null) { // Cross Compatible Event handling with 5.3 // TODO : find a replacement event handler ...
[ "public", "function", "register", "(", ")", "{", "// Hook any mapper init and check the mapping include soft deletes.", "$", "this", "->", "manager", "->", "registerGlobalEvent", "(", "'initialized'", ",", "function", "(", "$", "event", ",", "$", "payload", "=", "null...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Plugins/SoftDeletes/SoftDeletesPlugin.php#L20-L43
analogueorm/analogue
src/Plugins/SoftDeletes/SoftDeletesPlugin.php
SoftDeletesPlugin.registerSoftDelete
protected function registerSoftDelete(Mapper $mapper) { $entityMap = $mapper->getEntityMap(); // Add Scopes $mapper->addGlobalScope(new SoftDeletingScope()); // Register 'deleting' events $mapper->registerEvent('deleting', function ($event) use ($entityMap) { $e...
php
protected function registerSoftDelete(Mapper $mapper) { $entityMap = $mapper->getEntityMap(); // Add Scopes $mapper->addGlobalScope(new SoftDeletingScope()); // Register 'deleting' events $mapper->registerEvent('deleting', function ($event) use ($entityMap) { $e...
[ "protected", "function", "registerSoftDelete", "(", "Mapper", "$", "mapper", ")", "{", "$", "entityMap", "=", "$", "mapper", "->", "getEntityMap", "(", ")", ";", "// Add Scopes", "$", "mapper", "->", "addGlobalScope", "(", "new", "SoftDeletingScope", "(", ")",...
By hooking to the mapper initialization event, we can extend it with the softDelete capacity. @param \Analogue\ORM\System\Mapper $mapper @throws \Analogue\ORM\Exceptions\MappingException @return bool|void
[ "By", "hooking", "to", "the", "mapper", "initialization", "event", "we", "can", "extend", "it", "with", "the", "softDelete", "capacity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Plugins/SoftDeletes/SoftDeletesPlugin.php#L55-L85
analogueorm/analogue
src/Commands/Delete.php
Delete.execute
public function execute() { $aggregate = $this->aggregate; $entity = $aggregate->getEntityObject(); $wrappedEntity = $aggregate->getWrappedEntity(); $mapper = $aggregate->getMapper(); if ($mapper->fireEvent('deleting', $wrappedEntity) === false) { return false; ...
php
public function execute() { $aggregate = $this->aggregate; $entity = $aggregate->getEntityObject(); $wrappedEntity = $aggregate->getWrappedEntity(); $mapper = $aggregate->getMapper(); if ($mapper->fireEvent('deleting', $wrappedEntity) === false) { return false; ...
[ "public", "function", "execute", "(", ")", "{", "$", "aggregate", "=", "$", "this", "->", "aggregate", ";", "$", "entity", "=", "$", "aggregate", "->", "getEntityObject", "(", ")", ";", "$", "wrappedEntity", "=", "$", "aggregate", "->", "getWrappedEntity",...
Execute the Delete Statement. @throws MappingException @throws \InvalidArgumentException @return false|void
[ "Execute", "the", "Delete", "Statement", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Commands/Delete.php#L17-L40
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.initializeProxy
public function initializeProxy() : bool { if ($this->isProxyInitialized()) { return true; } $this->items = $this->prependedItems + $this->getRelationshipInstance() ->getResults($this->relationshipMethod)->all() + $this->pushedItems; $this->relationshipLoade...
php
public function initializeProxy() : bool { if ($this->isProxyInitialized()) { return true; } $this->items = $this->prependedItems + $this->getRelationshipInstance() ->getResults($this->relationshipMethod)->all() + $this->pushedItems; $this->relationshipLoade...
[ "public", "function", "initializeProxy", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "isProxyInitialized", "(", ")", ")", "{", "return", "true", ";", "}", "$", "this", "->", "items", "=", "$", "this", "->", "prependedItems", "+", "$", "...
Force initialization of the proxy. @return bool true if the proxy could be initialized
[ "Force", "initialization", "of", "the", "proxy", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L78-L90
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.getRelationshipInstance
protected function getRelationshipInstance() : Relationship { $relation = $this->relationshipMethod; $entity = $this->parentEntity; $entityMap = Manager::getMapper($entity)->getEntityMap(); return $entityMap->$relation($entity); }
php
protected function getRelationshipInstance() : Relationship { $relation = $this->relationshipMethod; $entity = $this->parentEntity; $entityMap = Manager::getMapper($entity)->getEntityMap(); return $entityMap->$relation($entity); }
[ "protected", "function", "getRelationshipInstance", "(", ")", ":", "Relationship", "{", "$", "relation", "=", "$", "this", "->", "relationshipMethod", ";", "$", "entity", "=", "$", "this", "->", "parentEntity", ";", "$", "entityMap", "=", "Manager", "::", "g...
Return instance of the underlying relationship. @return Relationship
[ "Return", "instance", "of", "the", "underlying", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L97-L104
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.contains
public function contains($key, $operator = null, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); switch (func_num_args()) { case 1: return $parent->contains($key); case 2: return $parent->contains($key,...
php
public function contains($key, $operator = null, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); switch (func_num_args()) { case 1: return $parent->contains($key); case 2: return $parent->contains($key,...
[ "public", "function", "contains", "(", "$", "key", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L177-L191
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.containsStrict
public function containsStrict($key, $value = null) { $this->initializeProxy(); switch (func_num_args()) { case 1: return parent::containsStrict($key); case 2: return parent::containsStrict($key, $value); } }
php
public function containsStrict($key, $value = null) { $this->initializeProxy(); switch (func_num_args()) { case 1: return parent::containsStrict($key); case 2: return parent::containsStrict($key, $value); } }
[ "public", "function", "containsStrict", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "switch", "(", "func_num_args", "(", ")", ")", "{", "case", "1", ":", "return", "parent", "::", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L196-L206
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.diff
public function diff($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diff($items); }
php
public function diff($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diff($items); }
[ "public", "function", "diff", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "diff", "(", "$", "items", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L211-L218
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.diffUsing
public function diffUsing($items, callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffUsing($items, $callback); }
php
public function diffUsing($items, callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffUsing($items, $callback); }
[ "public", "function", "diffUsing", "(", "$", "items", ",", "callable", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L223-L230
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.diffAssocUsing
public function diffAssocUsing($items, callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffAssocUsing($items, $callback); }
php
public function diffAssocUsing($items, callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffAssocUsing($items, $callback); }
[ "public", "function", "diffAssocUsing", "(", "$", "items", ",", "callable", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L235-L242
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.diffKeys
public function diffKeys($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffKeys($items); }
php
public function diffKeys($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffKeys($items); }
[ "public", "function", "diffKeys", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "diffKeys", "(", "$", "items", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L247-L254
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.diffKeysUsing
public function diffKeysUsing($items, callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffKeysUsing($items); }
php
public function diffKeysUsing($items, callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffKeysUsing($items); }
[ "public", "function", "diffKeysUsing", "(", "$", "items", ",", "callable", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L259-L266
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.except
public function except($keys) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->except($keys); }
php
public function except($keys) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->except($keys); }
[ "public", "function", "except", "(", "$", "keys", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "except", "(", "$", "keys", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L300-L307
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.filter
public function filter(callable $callback = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->filter($callback); }
php
public function filter(callable $callback = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->filter($callback); }
[ "public", "function", "filter", "(", "callable", "$", "callback", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "filt...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L312-L319