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/ValueMap.php
ValueMap.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/ValueMap.php#L128-L141
analogueorm/analogue
src/ValueMap.php
ValueMap.getAttributeNameForColumn
public function getAttributeNameForColumn($columnName) { if (!empty($this->mappings)) { if (isset($this->mappings[$columnName])) { return $this->mappings[$columnName]; } } return $columnName; }
php
public function getAttributeNameForColumn($columnName) { if (!empty($this->mappings)) { if (isset($this->mappings[$columnName])) { return $this->mappings[$columnName]; } } return $columnName; }
[ "public", "function", "getAttributeNameForColumn", "(", "$", "columnName", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "mappings", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "mappings", "[", "$", "columnName", "]", ")", ...
Gets the entity attribute name of a given column in a table. @param string $columnName @return string
[ "Gets", "the", "entity", "attribute", "name", "of", "a", "given", "column", "in", "a", "table", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/ValueMap.php#L150-L159
analogueorm/analogue
src/ValueMap.php
ValueMap.getColumnNameForAttribute
public function getColumnNameForAttribute($attributeName) { if (!empty($this->mappings)) { $flipped = array_flip($this->mappings); if (isset($flipped[$attributeName])) { return $flipped[$attributeName]; } } return $attributeName; }
php
public function getColumnNameForAttribute($attributeName) { if (!empty($this->mappings)) { $flipped = array_flip($this->mappings); if (isset($flipped[$attributeName])) { return $flipped[$attributeName]; } } return $attributeName; }
[ "public", "function", "getColumnNameForAttribute", "(", "$", "attributeName", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "mappings", ")", ")", "{", "$", "flipped", "=", "array_flip", "(", "$", "this", "->", "mappings", ")", ";", "if", "...
Gets the column name of a given entity attribute. @param string $attributeName @return string
[ "Gets", "the", "column", "name", "of", "a", "given", "entity", "attribute", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/ValueMap.php#L168-L178
analogueorm/analogue
src/ValueMap.php
ValueMap.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/ValueMap.php#L189-L203
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.build
public function build(array $results, array $eagerLoads) { // First, we'll cache the raw result set $this->cacheResults($results); // Parse embedded relations and build corresponding entities using the default // mapper. $results = $this->buildEmbeddedRelationships($results)...
php
public function build(array $results, array $eagerLoads) { // First, we'll cache the raw result set $this->cacheResults($results); // Parse embedded relations and build corresponding entities using the default // mapper. $results = $this->buildEmbeddedRelationships($results)...
[ "public", "function", "build", "(", "array", "$", "results", ",", "array", "$", "eagerLoads", ")", "{", "// First, we'll cache the raw result set", "$", "this", "->", "cacheResults", "(", "$", "results", ")", ";", "// Parse embedded relations and build corresponding ent...
Convert a result set into an array of entities. @param array $results The results to convert into entities. @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/ResultBuilder.php#L68-L82
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.cacheResults
protected function cacheResults(array $results) { $mapper = $this->mapper; // When hydrating EmbeddedValue object, they'll likely won't // have a primary key set. if ($mapper->getEntityMap()->getKeyName() !== null) { $mapper->getEntityCache()->add($results); } ...
php
protected function cacheResults(array $results) { $mapper = $this->mapper; // When hydrating EmbeddedValue object, they'll likely won't // have a primary key set. if ($mapper->getEntityMap()->getKeyName() !== null) { $mapper->getEntityCache()->add($results); } ...
[ "protected", "function", "cacheResults", "(", "array", "$", "results", ")", "{", "$", "mapper", "=", "$", "this", "->", "mapper", ";", "// When hydrating EmbeddedValue object, they'll likely won't", "// have a primary key set.", "if", "(", "$", "mapper", "->", "getEnt...
Cache result set. @param array $results @return void
[ "Cache", "result", "set", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L91-L100
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.buildEmbeddedRelationships
protected function buildEmbeddedRelationships(array $results) : array { $entityMap = $this->entityMap; $instance = $this->mapper->newInstance(); $embeddeds = $entityMap->getEmbeddedRelationships(); foreach ($embeddeds as $embedded) { $results = $entityMap->$embedded($ins...
php
protected function buildEmbeddedRelationships(array $results) : array { $entityMap = $this->entityMap; $instance = $this->mapper->newInstance(); $embeddeds = $entityMap->getEmbeddedRelationships(); foreach ($embeddeds as $embedded) { $results = $entityMap->$embedded($ins...
[ "protected", "function", "buildEmbeddedRelationships", "(", "array", "$", "results", ")", ":", "array", "{", "$", "entityMap", "=", "$", "this", "->", "entityMap", ";", "$", "instance", "=", "$", "this", "->", "mapper", "->", "newInstance", "(", ")", ";", ...
Build embedded objects and match them to the result set. @param array $results @return array
[ "Build", "embedded", "objects", "and", "match", "them", "to", "the", "result", "set", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L109-L120
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.queryEagerLoadedRelationships
protected function queryEagerLoadedRelationships(array $results, array $eagerLoads) : array { $this->eagerLoads = $this->parseRelations($eagerLoads); return $this->eagerLoadRelations($results); }
php
protected function queryEagerLoadedRelationships(array $results, array $eagerLoads) : array { $this->eagerLoads = $this->parseRelations($eagerLoads); return $this->eagerLoadRelations($results); }
[ "protected", "function", "queryEagerLoadedRelationships", "(", "array", "$", "results", ",", "array", "$", "eagerLoads", ")", ":", "array", "{", "$", "this", "->", "eagerLoads", "=", "$", "this", "->", "parseRelations", "(", "$", "eagerLoads", ")", ";", "ret...
Launch queries on eager loaded relationships. @param array $results @param array $eagerLoads @return array
[ "Launch", "queries", "on", "eager", "loaded", "relationships", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L130-L135
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.eagerLoadRelations
public function eagerLoadRelations(array $results): array { foreach ($this->eagerLoads as $name => $constraints) { // First, we'll check if the entity map has a relation and just pass if it // is not the case if (!in_array($name, $this->entityMap->getRelationships())) { ...
php
public function eagerLoadRelations(array $results): array { foreach ($this->eagerLoads as $name => $constraints) { // First, we'll check if the entity map has a relation and just pass if it // is not the case if (!in_array($name, $this->entityMap->getRelationships())) { ...
[ "public", "function", "eagerLoadRelations", "(", "array", "$", "results", ")", ":", "array", "{", "foreach", "(", "$", "this", "->", "eagerLoads", "as", "$", "name", "=>", "$", "constraints", ")", "{", "// First, we'll check if the entity map has a relation and just...
Eager load the relationships on a result set. @param array $results @return array
[ "Eager", "load", "the", "relationships", "on", "a", "result", "set", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L204-L223
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.loadRelation
protected function loadRelation(array $results, string $name, Closure $constraints) : array { // First we will "back up" the existing where conditions on the query so we can // add our eager constraints. Then we will merge the wheres that were on the // query back to it in order that any whe...
php
protected function loadRelation(array $results, string $name, Closure $constraints) : array { // First we will "back up" the existing where conditions on the query so we can // add our eager constraints. Then we will merge the wheres that were on the // query back to it in order that any whe...
[ "protected", "function", "loadRelation", "(", "array", "$", "results", ",", "string", "$", "name", ",", "Closure", "$", "constraints", ")", ":", "array", "{", "// First we will \"back up\" the existing where conditions on the query so we can", "// add our eager constraints. T...
Eagerly load the relationship on a set of entities. @param array $results @param string $name @param \Closure $constraints @return array
[ "Eagerly", "load", "the", "relationship", "on", "a", "set", "of", "entities", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L234-L249
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.getRelation
public function getRelation(string $relation) : Relationship { // We want to run a relationship query without any constrains so that we will // not have to remove these where clauses manually which gets really hacky // and is error prone while we remove the developer's own where clauses. ...
php
public function getRelation(string $relation) : Relationship { // We want to run a relationship query without any constrains so that we will // not have to remove these where clauses manually which gets really hacky // and is error prone while we remove the developer's own where clauses. ...
[ "public", "function", "getRelation", "(", "string", "$", "relation", ")", ":", "Relationship", "{", "// We want to run a relationship query without any constrains so that we will", "// not have to remove these where clauses manually which gets really hacky", "// and is error prone while we...
Get the relation instance for the given relation name. @param string $relation @return \Analogue\ORM\Relationships\Relationship
[ "Get", "the", "relation", "instance", "for", "the", "given", "relation", "name", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L258-L277
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.nestedRelations
protected function nestedRelations(string $relation): array { $nested = []; // We are basically looking for any relationships that are nested deeper than // the given top-level relationship. We will just check for any relations // that start with the given top relations and adds the...
php
protected function nestedRelations(string $relation): array { $nested = []; // We are basically looking for any relationships that are nested deeper than // the given top-level relationship. We will just check for any relations // that start with the given top relations and adds the...
[ "protected", "function", "nestedRelations", "(", "string", "$", "relation", ")", ":", "array", "{", "$", "nested", "=", "[", "]", ";", "// We are basically looking for any relationships that are nested deeper than", "// the given top-level relationship. We will just check for any...
Get the deeply nested relations for a given top-level relation. @param string $relation @return array
[ "Get", "the", "deeply", "nested", "relations", "for", "a", "given", "top", "-", "level", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L286-L300
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.isNested
protected function isNested(string $name, string $relation): bool { $dots = str_contains($name, '.'); return $dots && starts_with($name, $relation.'.'); }
php
protected function isNested(string $name, string $relation): bool { $dots = str_contains($name, '.'); return $dots && starts_with($name, $relation.'.'); }
[ "protected", "function", "isNested", "(", "string", "$", "name", ",", "string", "$", "relation", ")", ":", "bool", "{", "$", "dots", "=", "str_contains", "(", "$", "name", ",", "'.'", ")", ";", "return", "$", "dots", "&&", "starts_with", "(", "$", "n...
Determine if the relationship is nested. @param string $name @param string $relation @return bool
[ "Determine", "if", "the", "relationship", "is", "nested", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L310-L315
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.buildUnkeyedResultSet
protected function buildUnkeyedResultSet(array $results) : array { $builder = new EntityBuilder($this->mapper, array_keys($this->eagerLoads), $this->useCache); return array_map(function ($item) use ($builder) { return $builder->build($item); }, $results); }
php
protected function buildUnkeyedResultSet(array $results) : array { $builder = new EntityBuilder($this->mapper, array_keys($this->eagerLoads), $this->useCache); return array_map(function ($item) use ($builder) { return $builder->build($item); }, $results); }
[ "protected", "function", "buildUnkeyedResultSet", "(", "array", "$", "results", ")", ":", "array", "{", "$", "builder", "=", "new", "EntityBuilder", "(", "$", "this", "->", "mapper", ",", "array_keys", "(", "$", "this", "->", "eagerLoads", ")", ",", "$", ...
Build a result set. @param array $results @return array
[ "Build", "a", "result", "set", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L336-L343
analogueorm/analogue
src/System/Builders/ResultBuilder.php
ResultBuilder.buildKeyedResultSet
protected function buildKeyedResultSet(array $results, string $primaryKey) : array { $builder = new EntityBuilder($this->mapper, array_keys($this->eagerLoads), $this->useCache); $keys = array_map(function ($item) use ($primaryKey) { return $item[$primaryKey]; }, $results); ...
php
protected function buildKeyedResultSet(array $results, string $primaryKey) : array { $builder = new EntityBuilder($this->mapper, array_keys($this->eagerLoads), $this->useCache); $keys = array_map(function ($item) use ($primaryKey) { return $item[$primaryKey]; }, $results); ...
[ "protected", "function", "buildKeyedResultSet", "(", "array", "$", "results", ",", "string", "$", "primaryKey", ")", ":", "array", "{", "$", "builder", "=", "new", "EntityBuilder", "(", "$", "this", "->", "mapper", ",", "array_keys", "(", "$", "this", "->"...
Build a result set keyed by PK. @param array $results @param string. $primaryKey @return array
[ "Build", "a", "result", "set", "keyed", "by", "PK", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/ResultBuilder.php#L353-L364
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.add
public function add(array $results) { $cachedResults = []; $keyColumn = $this->entityMap->getKeyName(); foreach ($results as $result) { $id = $result[$keyColumn]; // Forget the ID field from the cache attributes // to prevent any side effect. ...
php
public function add(array $results) { $cachedResults = []; $keyColumn = $this->entityMap->getKeyName(); foreach ($results as $result) { $id = $result[$keyColumn]; // Forget the ID field from the cache attributes // to prevent any side effect. ...
[ "public", "function", "add", "(", "array", "$", "results", ")", "{", "$", "cachedResults", "=", "[", "]", ";", "$", "keyColumn", "=", "$", "this", "->", "entityMap", "->", "getKeyName", "(", ")", ";", "foreach", "(", "$", "results", "as", "$", "resul...
Add an array of key=>attributes representing the initial state of loaded entities. @param array $results
[ "Add", "an", "array", "of", "key", "=", ">", "attributes", "representing", "the", "initial", "state", "of", "loaded", "entities", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L74-L95
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.get
public function get(string $id = null): array { if ($this->has($id)) { return $this->cache[$id]; } return []; }
php
public function get(string $id = null): array { if ($this->has($id)) { return $this->cache[$id]; } return []; }
[ "public", "function", "get", "(", "string", "$", "id", "=", "null", ")", ":", "array", "{", "if", "(", "$", "this", "->", "has", "(", "$", "id", ")", ")", "{", "return", "$", "this", "->", "cache", "[", "$", "id", "]", ";", "}", "return", "["...
Retrieve initial attributes for a single entity. @param string $id @return array
[ "Retrieve", "initial", "attributes", "for", "a", "single", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L120-L127
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.mergeCacheResults
protected function mergeCacheResults(array $results) { foreach ($results as $key => $entity) { $this->cache[$key] = $entity; } }
php
protected function mergeCacheResults(array $results) { foreach ($results as $key => $entity) { $this->cache[$key] = $entity; } }
[ "protected", "function", "mergeCacheResults", "(", "array", "$", "results", ")", "{", "foreach", "(", "$", "results", "as", "$", "key", "=>", "$", "entity", ")", "{", "$", "this", "->", "cache", "[", "$", "key", "]", "=", "$", "entity", ";", "}", "...
Combine new result set with existing attributes in cache. @param array $results @return void
[ "Combine", "new", "result", "set", "with", "existing", "attributes", "in", "cache", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L149-L154
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.cacheLoadedRelationResult
public function cacheLoadedRelationResult(string $key, string $relation, $results, Relationship $relationship) { if ($results instanceof EntityCollection) { $this->cacheManyRelationResults($key, $relation, $results, $relationship); } // TODO : As we support popo Entities, Maybe ...
php
public function cacheLoadedRelationResult(string $key, string $relation, $results, Relationship $relationship) { if ($results instanceof EntityCollection) { $this->cacheManyRelationResults($key, $relation, $results, $relationship); } // TODO : As we support popo Entities, Maybe ...
[ "public", "function", "cacheLoadedRelationResult", "(", "string", "$", "key", ",", "string", "$", "relation", ",", "$", "results", ",", "Relationship", "$", "relationship", ")", "{", "if", "(", "$", "results", "instanceof", "EntityCollection", ")", "{", "$", ...
Cache Relation's query result for an entity. @param string $key primary key of the cached entity @param string $relation name of the relation @param mixed $results results of the relationship's query @param Relationship $relationship @throws MappingException @return void
[ "Cache", "Relation", "s", "query", "result", "for", "an", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L168-L179
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.getCachedRelationship
protected function getCachedRelationship(string $relation, $result, Relationship $relationship) { $pivotColumns = $relationship->getPivotAttributes(); if (!array_key_exists($relation, $this->pivotAttributes)) { $this->pivotAttributes[$relation] = $pivotColumns; } $wrapp...
php
protected function getCachedRelationship(string $relation, $result, Relationship $relationship) { $pivotColumns = $relationship->getPivotAttributes(); if (!array_key_exists($relation, $this->pivotAttributes)) { $this->pivotAttributes[$relation] = $pivotColumns; } $wrapp...
[ "protected", "function", "getCachedRelationship", "(", "string", "$", "relation", ",", "$", "result", ",", "Relationship", "$", "relationship", ")", "{", "$", "pivotColumns", "=", "$", "relationship", "->", "getPivotAttributes", "(", ")", ";", "if", "(", "!", ...
Create a cachedRelationship instance which will hold related entity's hash and pivot attributes, if any. @param string $relation @param array $result @param Relationship $relationship @throws MappingException @return CachedRelationship
[ "Create", "a", "cachedRelationship", "instance", "which", "will", "hold", "related", "entity", "s", "hash", "and", "pivot", "attributes", "if", "any", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L192-L220
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.cacheManyRelationResults
protected function cacheManyRelationResults(string $parentKey, string $relation, $results, Relationship $relationship) { $this->cache[$parentKey][$relation] = []; foreach ($results as $result) { $cachedRelationship = $this->getCachedRelationship($relation, $result, $relationship); ...
php
protected function cacheManyRelationResults(string $parentKey, string $relation, $results, Relationship $relationship) { $this->cache[$parentKey][$relation] = []; foreach ($results as $result) { $cachedRelationship = $this->getCachedRelationship($relation, $result, $relationship); ...
[ "protected", "function", "cacheManyRelationResults", "(", "string", "$", "parentKey", ",", "string", "$", "relation", ",", "$", "results", ",", "Relationship", "$", "relationship", ")", "{", "$", "this", "->", "cache", "[", "$", "parentKey", "]", "[", "$", ...
Cache a many relationship. @param string $parentKey @param string $relation @param EntityCollection $results @param Relationship $relationship @throws MappingException
[ "Cache", "a", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L232-L243
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.cacheSingleRelationResult
protected function cacheSingleRelationResult(string $parentKey, string $relation, $result, Relationship $relationship) { $this->cache[$parentKey][$relation] = $this->getCachedRelationship($relation, $result, $relationship); }
php
protected function cacheSingleRelationResult(string $parentKey, string $relation, $result, Relationship $relationship) { $this->cache[$parentKey][$relation] = $this->getCachedRelationship($relation, $result, $relationship); }
[ "protected", "function", "cacheSingleRelationResult", "(", "string", "$", "parentKey", ",", "string", "$", "relation", ",", "$", "result", ",", "Relationship", "$", "relationship", ")", "{", "$", "this", "->", "cache", "[", "$", "parentKey", "]", "[", "$", ...
Cache a single relationship. @param string $parentKey @param string $relation @param Mappable $result @param Relationship $relationship @throws MappingException
[ "Cache", "a", "single", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L255-L258
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.getEntityHash
protected function getEntityHash(InternallyMappable $entity): string { $class = $entity->getEntityClass(); $mapper = Manager::getMapper($class); $keyName = $mapper->getEntityMap()->getKeyName(); return $class.'.'.$entity->getEntityAttribute($keyName); }
php
protected function getEntityHash(InternallyMappable $entity): string { $class = $entity->getEntityClass(); $mapper = Manager::getMapper($class); $keyName = $mapper->getEntityMap()->getKeyName(); return $class.'.'.$entity->getEntityAttribute($keyName); }
[ "protected", "function", "getEntityHash", "(", "InternallyMappable", "$", "entity", ")", ":", "string", "{", "$", "class", "=", "$", "entity", "->", "getEntityClass", "(", ")", ";", "$", "mapper", "=", "Manager", "::", "getMapper", "(", "$", "class", ")", ...
Get Entity's Hash. @param $entity @throws MappingException @return string
[ "Get", "Entity", "s", "Hash", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L269-L278
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.refresh
public function refresh(Aggregate $entity) { $this->cache[$entity->getEntityKeyValue()] = $this->transform($entity); }
php
public function refresh(Aggregate $entity) { $this->cache[$entity->getEntityKeyValue()] = $this->transform($entity); }
[ "public", "function", "refresh", "(", "Aggregate", "$", "entity", ")", "{", "$", "this", "->", "cache", "[", "$", "entity", "->", "getEntityKeyValue", "(", ")", "]", "=", "$", "this", "->", "transform", "(", "$", "entity", ")", ";", "}" ]
Refresh the cache record for an aggregated entity after a write operation. @param Aggregate $entity
[ "Refresh", "the", "cache", "record", "for", "an", "aggregated", "entity", "after", "a", "write", "operation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L285-L288
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.transform
protected function transform(Aggregate $aggregatedEntity): array { $baseAttributes = $aggregatedEntity->getRawAttributes(); $relationAttributes = []; // First we'll handle each relationships that are a one to one // relation, and which will be saved as a CachedRelationship ...
php
protected function transform(Aggregate $aggregatedEntity): array { $baseAttributes = $aggregatedEntity->getRawAttributes(); $relationAttributes = []; // First we'll handle each relationships that are a one to one // relation, and which will be saved as a CachedRelationship ...
[ "protected", "function", "transform", "(", "Aggregate", "$", "aggregatedEntity", ")", ":", "array", "{", "$", "baseAttributes", "=", "$", "aggregatedEntity", "->", "getRawAttributes", "(", ")", ";", "$", "relationAttributes", "=", "[", "]", ";", "// First we'll ...
Transform an Aggregated Entity into a cache record. @param Aggregate $aggregatedEntity @throws MappingException @return array
[ "Transform", "an", "Aggregated", "Entity", "into", "a", "cache", "record", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L299-L341
analogueorm/analogue
src/System/Cache/AttributeCache.php
AttributeCache.getPivotValues
protected function getPivotValues(string $relation, InternallyMappable $entity): array { $values = []; $entityAttributes = $entity->getEntityAttributes(); if (array_key_exists($relation, $this->pivotAttributes)) { foreach ($this->pivotAttributes[$relation] as $attribute) { ...
php
protected function getPivotValues(string $relation, InternallyMappable $entity): array { $values = []; $entityAttributes = $entity->getEntityAttributes(); if (array_key_exists($relation, $this->pivotAttributes)) { foreach ($this->pivotAttributes[$relation] as $attribute) { ...
[ "protected", "function", "getPivotValues", "(", "string", "$", "relation", ",", "InternallyMappable", "$", "entity", ")", ":", "array", "{", "$", "values", "=", "[", "]", ";", "$", "entityAttributes", "=", "$", "entity", "->", "getEntityAttributes", "(", ")"...
Get pivot attributes for a relation. @param string $relation @param InternallyMappable $entity @return array
[ "Get", "pivot", "attributes", "for", "a", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Cache/AttributeCache.php#L351-L366
analogueorm/analogue
src/Relationships/BelongsTo.php
BelongsTo.getResults
public function getResults($relation) { $result = $this->query->first(); $this->cacheRelation($result, $relation); return $result; }
php
public function getResults($relation) { $result = $this->query->first(); $this->cacheRelation($result, $relation); return $result; }
[ "public", "function", "getResults", "(", "$", "relation", ")", "{", "$", "result", "=", "$", "this", "->", "query", "->", "first", "(", ")", ";", "$", "this", "->", "cacheRelation", "(", "$", "result", ",", "$", "relation", ")", ";", "return", "$", ...
Get the results of the relationship. @param $relation @return \Analogue\ORM\Entity
[ "Get", "the", "results", "of", "the", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsTo.php#L59-L66
analogueorm/analogue
src/Relationships/BelongsTo.php
BelongsTo.getRelationCountQuery
public function getRelationCountQuery(Query $query, Query $parent) { $query->select(new Expression('count(*)')); $otherKey = $this->wrap($query->getTable().'.'.$this->otherKey); return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey)); }
php
public function getRelationCountQuery(Query $query, Query $parent) { $query->select(new Expression('count(*)')); $otherKey = $this->wrap($query->getTable().'.'.$this->otherKey); return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey)); }
[ "public", "function", "getRelationCountQuery", "(", "Query", "$", "query", ",", "Query", "$", "parent", ")", "{", "$", "query", "->", "select", "(", "new", "Expression", "(", "'count(*)'", ")", ")", ";", "$", "otherKey", "=", "$", "this", "->", "wrap", ...
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/BelongsTo.php#L91-L98
analogueorm/analogue
src/Relationships/BelongsTo.php
BelongsTo.addEagerConstraints
public function addEagerConstraints(array $results) { // We'll grab the primary key name of the related models since it could be set to // a non-standard name and not "id". We will then construct the constraint for // our eagerly loading query so it returns the proper models from execution. ...
php
public function addEagerConstraints(array $results) { // We'll grab the primary key name of the related models since it could be set to // a non-standard name and not "id". We will then construct the constraint for // our eagerly loading query so it returns the proper models from execution. ...
[ "public", "function", "addEagerConstraints", "(", "array", "$", "results", ")", "{", "// We'll grab the primary key name of the related models since it could be set to", "// a non-standard name and not \"id\". We will then construct the constraint for", "// our eagerly loading query so it retu...
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/BelongsTo.php#L107-L115
analogueorm/analogue
src/Relationships/BelongsTo.php
BelongsTo.getEagerModelKeys
protected function getEagerModelKeys(array $results) { $keys = []; // First we need to gather all of the keys from the result set so we know what // to query for via the eager loading query. We will add them to an array then // execute a "where in" statement to gather up all of thos...
php
protected function getEagerModelKeys(array $results) { $keys = []; // First we need to gather all of the keys from the result set so we know what // to query for via the eager loading query. We will add them to an array then // execute a "where in" statement to gather up all of thos...
[ "protected", "function", "getEagerModelKeys", "(", "array", "$", "results", ")", "{", "$", "keys", "=", "[", "]", ";", "// First we need to gather all of the keys from the result set so we know what", "// to query for via the eager loading query. We will add them to an array then", ...
Gather the keys from an array of related models. @param array $results @return array
[ "Gather", "the", "keys", "from", "an", "array", "of", "related", "models", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsTo.php#L124-L145
analogueorm/analogue
src/Relationships/BelongsTo.php
BelongsTo.match
public function match(array $results, $relation) { $foreign = $this->foreignKey; $other = $this->otherKey; // Execute the relationship and get related entities as an EntityCollection $entities = $this->getEager(); // First we will get to build a dictionary of the child mod...
php
public function match(array $results, $relation) { $foreign = $this->foreignKey; $other = $this->otherKey; // Execute the relationship and get related entities as an EntityCollection $entities = $this->getEager(); // First we will get to build a dictionary of the child mod...
[ "public", "function", "match", "(", "array", "$", "results", ",", "$", "relation", ")", "{", "$", "foreign", "=", "$", "this", "->", "foreignKey", ";", "$", "other", "=", "$", "this", "->", "otherKey", ";", "// Execute the relationship and get related entities...
Match the Results array to an eagerly loaded relation. @param array $results @param string $relation @return array
[ "Match", "the", "Results", "array", "to", "an", "eagerly", "loaded", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsTo.php#L155-L190
analogueorm/analogue
src/Relationships/BelongsTo.php
BelongsTo.associate
public function associate($entity) { $this->parent->setEntityAttribute($this->foreignKey, $entity->getEntityAttribute($this->otherKey)); }
php
public function associate($entity) { $this->parent->setEntityAttribute($this->foreignKey, $entity->getEntityAttribute($this->otherKey)); }
[ "public", "function", "associate", "(", "$", "entity", ")", "{", "$", "this", "->", "parent", "->", "setEntityAttribute", "(", "$", "this", "->", "foreignKey", ",", "$", "entity", "->", "getEntityAttribute", "(", "$", "this", "->", "otherKey", ")", ")", ...
Associate the model instance to the given parent. @param mixed $entity @return void
[ "Associate", "the", "model", "instance", "to", "the", "given", "parent", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/BelongsTo.php#L212-L215
analogueorm/analogue
src/MagicCasting.php
MagicCasting.attributesToArray
protected function attributesToArray(array $sourceAttributes) { $attributes = []; foreach ($sourceAttributes as $key => $attribute) { // If the attribute is a proxy, and hasn't be loaded, we discard // it from the returned set. if ($attribute instanceof ProxyInte...
php
protected function attributesToArray(array $sourceAttributes) { $attributes = []; foreach ($sourceAttributes as $key => $attribute) { // If the attribute is a proxy, and hasn't be loaded, we discard // it from the returned set. if ($attribute instanceof ProxyInte...
[ "protected", "function", "attributesToArray", "(", "array", "$", "sourceAttributes", ")", "{", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "sourceAttributes", "as", "$", "key", "=>", "$", "attribute", ")", "{", "// If the attribute is a proxy, an...
Transform the Object to array/json,. @param array $sourceAttributes @return array
[ "Transform", "the", "Object", "to", "array", "/", "json", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/MagicCasting.php#L99-L123
analogueorm/analogue
src/System/Mapper.php
Mapper.map
public function map($results, array $eagerLoads = [], $useCache = false) : Collection { $builder = $this->newResultBuilder(!$useCache); if ($results instanceof Collection) { // Get underlying collection array $results = $results->all(); } if (!is_array($resu...
php
public function map($results, array $eagerLoads = [], $useCache = false) : Collection { $builder = $this->newResultBuilder(!$useCache); if ($results instanceof Collection) { // Get underlying collection array $results = $results->all(); } if (!is_array($resu...
[ "public", "function", "map", "(", "$", "results", ",", "array", "$", "eagerLoads", "=", "[", "]", ",", "$", "useCache", "=", "false", ")", ":", "Collection", "{", "$", "builder", "=", "$", "this", "->", "newResultBuilder", "(", "!", "$", "useCache", ...
Map results to a Collection. @param array|Collection $results @param array $eagerLoads @param bool $useCache @return Collection
[ "Map", "results", "to", "a", "Collection", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L133-L158
analogueorm/analogue
src/System/Mapper.php
Mapper.newResultBuilder
protected function newResultBuilder(bool $skipCache = false) : ResultBuilderInterface { $factory = new ResultBuilderFactory(); return $factory->make($this, $skipCache); }
php
protected function newResultBuilder(bool $skipCache = false) : ResultBuilderInterface { $factory = new ResultBuilderFactory(); return $factory->make($this, $skipCache); }
[ "protected", "function", "newResultBuilder", "(", "bool", "$", "skipCache", "=", "false", ")", ":", "ResultBuilderInterface", "{", "$", "factory", "=", "new", "ResultBuilderFactory", "(", ")", ";", "return", "$", "factory", "->", "make", "(", "$", "this", ",...
Return result builder used by this mapper. @param bool $skipCache @return ResultBuilderInterface
[ "Return", "result", "builder", "used", "by", "this", "mapper", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L167-L172
analogueorm/analogue
src/System/Mapper.php
Mapper.store
public function store($entity) { if ($this->manager->isTraversable($entity)) { return $this->storeCollection($entity); } else { return $this->storeEntity($entity); } }
php
public function store($entity) { if ($this->manager->isTraversable($entity)) { return $this->storeCollection($entity); } else { return $this->storeEntity($entity); } }
[ "public", "function", "store", "(", "$", "entity", ")", "{", "if", "(", "$", "this", "->", "manager", "->", "isTraversable", "(", "$", "entity", ")", ")", "{", "return", "$", "this", "->", "storeCollection", "(", "$", "entity", ")", ";", "}", "else",...
Persist an entity or an entity collection into the database. @param Mappable|\Traversable|array $entity @throws \InvalidArgumentException @throws MappingException @return Mappable|\Traversable|array
[ "Persist", "an", "entity", "or", "an", "entity", "collection", "into", "the", "database", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L194-L201
analogueorm/analogue
src/System/Mapper.php
Mapper.storeCollection
protected function storeCollection($entities) { $this->adapter->beginTransaction(); foreach ($entities as $entity) { $this->storeEntity($entity); } $this->adapter->commit(); return $entities; }
php
protected function storeCollection($entities) { $this->adapter->beginTransaction(); foreach ($entities as $entity) { $this->storeEntity($entity); } $this->adapter->commit(); return $entities; }
[ "protected", "function", "storeCollection", "(", "$", "entities", ")", "{", "$", "this", "->", "adapter", "->", "beginTransaction", "(", ")", ";", "foreach", "(", "$", "entities", "as", "$", "entity", ")", "{", "$", "this", "->", "storeEntity", "(", "$",...
Store an entity collection inside a single DB Transaction. @param \Traversable|array $entities @throws \InvalidArgumentException @throws MappingException @return \Traversable|array
[ "Store", "an", "entity", "collection", "inside", "a", "single", "DB", "Transaction", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L213-L224
analogueorm/analogue
src/System/Mapper.php
Mapper.storeEntity
protected function storeEntity($entity) { $this->checkEntityType($entity); $store = new Store($this->aggregate($entity), $this->newQueryBuilder()); return $store->execute(); }
php
protected function storeEntity($entity) { $this->checkEntityType($entity); $store = new Store($this->aggregate($entity), $this->newQueryBuilder()); return $store->execute(); }
[ "protected", "function", "storeEntity", "(", "$", "entity", ")", "{", "$", "this", "->", "checkEntityType", "(", "$", "entity", ")", ";", "$", "store", "=", "new", "Store", "(", "$", "this", "->", "aggregate", "(", "$", "entity", ")", ",", "$", "this...
Store a single entity into the database. @param Mappable $entity @throws \InvalidArgumentException @throws MappingException @return \Analogue\ORM\Entity
[ "Store", "a", "single", "entity", "into", "the", "database", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L236-L243
analogueorm/analogue
src/System/Mapper.php
Mapper.checkEntityType
protected function checkEntityType($entity) { if (get_class($entity) != $this->entityMap->getClass() && !is_subclass_of($entity, $this->entityMap->getClass())) { $expected = $this->entityMap->getClass(); $actual = get_class($entity); throw new InvalidArgumentException("E...
php
protected function checkEntityType($entity) { if (get_class($entity) != $this->entityMap->getClass() && !is_subclass_of($entity, $this->entityMap->getClass())) { $expected = $this->entityMap->getClass(); $actual = get_class($entity); throw new InvalidArgumentException("E...
[ "protected", "function", "checkEntityType", "(", "$", "entity", ")", "{", "if", "(", "get_class", "(", "$", "entity", ")", "!=", "$", "this", "->", "entityMap", "->", "getClass", "(", ")", "&&", "!", "is_subclass_of", "(", "$", "entity", ",", "$", "thi...
Check that the entity correspond to the current mapper. @param mixed $entity @throws InvalidArgumentException @return void
[ "Check", "that", "the", "entity", "correspond", "to", "the", "current", "mapper", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L254-L262
analogueorm/analogue
src/System/Mapper.php
Mapper.delete
public function delete($entity) { if ($this->manager->isTraversable($entity)) { return $this->deleteCollection($entity); } else { $this->deleteEntity($entity); } }
php
public function delete($entity) { if ($this->manager->isTraversable($entity)) { return $this->deleteCollection($entity); } else { $this->deleteEntity($entity); } }
[ "public", "function", "delete", "(", "$", "entity", ")", "{", "if", "(", "$", "this", "->", "manager", "->", "isTraversable", "(", "$", "entity", ")", ")", "{", "return", "$", "this", "->", "deleteCollection", "(", "$", "entity", ")", ";", "}", "else...
Delete an entity or an entity collection from the database. @param Mappable|\Traversable|array @throws MappingException @throws \InvalidArgumentException @return \Traversable|array
[ "Delete", "an", "entity", "or", "an", "entity", "collection", "from", "the", "database", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L298-L305
analogueorm/analogue
src/System/Mapper.php
Mapper.deleteCollection
protected function deleteCollection($entities) { $this->adapter->beginTransaction(); foreach ($entities as $entity) { $this->deleteEntity($entity); } $this->adapter->commit(); return $entities; }
php
protected function deleteCollection($entities) { $this->adapter->beginTransaction(); foreach ($entities as $entity) { $this->deleteEntity($entity); } $this->adapter->commit(); return $entities; }
[ "protected", "function", "deleteCollection", "(", "$", "entities", ")", "{", "$", "this", "->", "adapter", "->", "beginTransaction", "(", ")", ";", "foreach", "(", "$", "entities", "as", "$", "entity", ")", "{", "$", "this", "->", "deleteEntity", "(", "$...
Delete an Entity Collection inside a single db transaction. @param \Traversable|array $entities @throws \InvalidArgumentException @throws MappingException @return \Traversable|array
[ "Delete", "an", "Entity", "Collection", "inside", "a", "single", "db", "transaction", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L317-L328
analogueorm/analogue
src/System/Mapper.php
Mapper.deleteEntity
protected function deleteEntity($entity) { $this->checkEntityType($entity); $delete = new Delete($this->aggregate($entity), $this->newQueryBuilder()); $delete->execute(); }
php
protected function deleteEntity($entity) { $this->checkEntityType($entity); $delete = new Delete($this->aggregate($entity), $this->newQueryBuilder()); $delete->execute(); }
[ "protected", "function", "deleteEntity", "(", "$", "entity", ")", "{", "$", "this", "->", "checkEntityType", "(", "$", "entity", ")", ";", "$", "delete", "=", "new", "Delete", "(", "$", "this", "->", "aggregate", "(", "$", "entity", ")", ",", "$", "t...
Delete a single entity from the database. @param Mappable $entity @throws \InvalidArgumentException @throws MappingException @return void
[ "Delete", "a", "single", "entity", "from", "the", "database", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L340-L347
analogueorm/analogue
src/System/Mapper.php
Mapper.fireEvent
public function fireEvent($event, $entity, $halt = true) { /*if ($entity instanceof Wrapper) { throw new InvalidArgumentException('Fired Event with invalid Entity Object'); }*/ $eventName = "analogue.{$event}.".$this->entityMap->getClass(); $method = $halt ? 'until' : '...
php
public function fireEvent($event, $entity, $halt = true) { /*if ($entity instanceof Wrapper) { throw new InvalidArgumentException('Fired Event with invalid Entity Object'); }*/ $eventName = "analogue.{$event}.".$this->entityMap->getClass(); $method = $halt ? 'until' : '...
[ "public", "function", "fireEvent", "(", "$", "event", ",", "$", "entity", ",", "$", "halt", "=", "true", ")", "{", "/*if ($entity instanceof Wrapper) {\n throw new InvalidArgumentException('Fired Event with invalid Entity Object');\n }*/", "$", "eventName", "=...
Fire the given event for the entity. @param string $event @param \Analogue\ORM\Entity $entity @param bool $halt @throws InvalidArgumentException @return mixed
[ "Fire", "the", "given", "event", "for", "the", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L401-L419
analogueorm/analogue
src/System/Mapper.php
Mapper.registerEvent
public function registerEvent($event, $callback) { $name = $this->entityMap->getClass(); $this->dispatcher->listen("analogue.{$event}.{$name}", $callback); }
php
public function registerEvent($event, $callback) { $name = $this->entityMap->getClass(); $this->dispatcher->listen("analogue.{$event}.{$name}", $callback); }
[ "public", "function", "registerEvent", "(", "$", "event", ",", "$", "callback", ")", "{", "$", "name", "=", "$", "this", "->", "entityMap", "->", "getClass", "(", ")", ";", "$", "this", "->", "dispatcher", "->", "listen", "(", "\"analogue.{$event}.{$name}\...
Register an entity event with the dispatcher. @param string $event @param \Closure $callback @return void
[ "Register", "an", "entity", "event", "with", "the", "dispatcher", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L429-L434
analogueorm/analogue
src/System/Mapper.php
Mapper.getGlobalScope
public function getGlobalScope($scope) { return array_first($this->globalScopes, function ($key, $value) use ($scope) { return $scope instanceof $value; }); }
php
public function getGlobalScope($scope) { return array_first($this->globalScopes, function ($key, $value) use ($scope) { return $scope instanceof $value; }); }
[ "public", "function", "getGlobalScope", "(", "$", "scope", ")", "{", "return", "array_first", "(", "$", "this", "->", "globalScopes", ",", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "scope", ")", "{", "return", "$", "scope", ...
Get a global scope registered with the modal. @param \Analogue\ORM\System\ScopeInterface $scope @return \Analogue\ORM\System\ScopeInterface|null
[ "Get", "a", "global", "scope", "registered", "with", "the", "modal", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L478-L483
analogueorm/analogue
src/System/Mapper.php
Mapper.newQueryWithoutScope
public function newQueryWithoutScope($scope) { $this->getGlobalScope($scope)->remove($query = $this->getQuery(), $this); return $query; }
php
public function newQueryWithoutScope($scope) { $this->getGlobalScope($scope)->remove($query = $this->getQuery(), $this); return $query; }
[ "public", "function", "newQueryWithoutScope", "(", "$", "scope", ")", "{", "$", "this", "->", "getGlobalScope", "(", "$", "scope", ")", "->", "remove", "(", "$", "query", "=", "$", "this", "->", "getQuery", "(", ")", ",", "$", "this", ")", ";", "retu...
Get a new query instance without a given scope. @param \Analogue\ORM\System\ScopeInterface $scope @return \Analogue\ORM\System\Query
[ "Get", "a", "new", "query", "instance", "without", "a", "given", "scope", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L492-L497
analogueorm/analogue
src/System/Mapper.php
Mapper.applyGlobalScopes
public function applyGlobalScopes($query) { foreach ($this->getGlobalScopes() as $scope) { $scope->apply($query, $this); } return $query; }
php
public function applyGlobalScopes($query) { foreach ($this->getGlobalScopes() as $scope) { $scope->apply($query, $this); } return $query; }
[ "public", "function", "applyGlobalScopes", "(", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "getGlobalScopes", "(", ")", "as", "$", "scope", ")", "{", "$", "scope", "->", "apply", "(", "$", "query", ",", "$", "this", ")", ";", "}", "...
Apply all of the global scopes to an Analogue Query builder. @param Query $query @return \Analogue\ORM\System\Query
[ "Apply", "all", "of", "the", "global", "scopes", "to", "an", "Analogue", "Query", "builder", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L518-L525
analogueorm/analogue
src/System/Mapper.php
Mapper.addCustomCommand
public function addCustomCommand($command) { $name = lcfirst(class_basename($command)); $this->customCommands[$name] = $command; }
php
public function addCustomCommand($command) { $name = lcfirst(class_basename($command)); $this->customCommands[$name] = $command; }
[ "public", "function", "addCustomCommand", "(", "$", "command", ")", "{", "$", "name", "=", "lcfirst", "(", "class_basename", "(", "$", "command", ")", ")", ";", "$", "this", "->", "customCommands", "[", "$", "name", "]", "=", "$", "command", ";", "}" ]
Add a dynamic method that extends the mapper/repository. @param string $command
[ "Add", "a", "dynamic", "method", "that", "extends", "the", "mapper", "/", "repository", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L542-L547
analogueorm/analogue
src/System/Mapper.php
Mapper.newInstance
public function newInstance() { $class = $this->entityMap->getClass(); if ($this->entityMap->useDependencyInjection()) { return $this->newInstanceUsingDependencyInjection($class); } return $this->newInstanceUsingInstantiator($class); }
php
public function newInstance() { $class = $this->entityMap->getClass(); if ($this->entityMap->useDependencyInjection()) { return $this->newInstanceUsingDependencyInjection($class); } return $this->newInstanceUsingInstantiator($class); }
[ "public", "function", "newInstance", "(", ")", "{", "$", "class", "=", "$", "this", "->", "entityMap", "->", "getClass", "(", ")", ";", "if", "(", "$", "this", "->", "entityMap", "->", "useDependencyInjection", "(", ")", ")", "{", "return", "$", "this"...
Create a new instance of the mapped entity class. @return mixed
[ "Create", "a", "new", "instance", "of", "the", "mapped", "entity", "class", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L554-L563
analogueorm/analogue
src/System/Mapper.php
Mapper.removeGlobalScopes
public function removeGlobalScopes($query) { foreach ($this->getGlobalScopes() as $scope) { $scope->remove($query, $this); } return $query; }
php
public function removeGlobalScopes($query) { foreach ($this->getGlobalScopes() as $scope) { $scope->remove($query, $this); } return $query; }
[ "public", "function", "removeGlobalScopes", "(", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "getGlobalScopes", "(", ")", "as", "$", "scope", ")", "{", "$", "scope", "->", "remove", "(", "$", "query", ",", "$", "this", ")", ";", "}", ...
Remove all of the global scopes from an Analogue Query builder. @param Query $query @return \Analogue\ORM\System\Query
[ "Remove", "all", "of", "the", "global", "scopes", "from", "an", "Analogue", "Query", "builder", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L624-L631
analogueorm/analogue
src/System/Mapper.php
Mapper.executeCustomCommand
public function executeCustomCommand($command, $entity) { $commandClass = $this->customCommands[$command]; if ($this->manager->isTraversable($entity)) { foreach ($entity as $instance) { $this->executeSingleCustomCommand($commandClass, $instance); } } ...
php
public function executeCustomCommand($command, $entity) { $commandClass = $this->customCommands[$command]; if ($this->manager->isTraversable($entity)) { foreach ($entity as $instance) { $this->executeSingleCustomCommand($commandClass, $instance); } } ...
[ "public", "function", "executeCustomCommand", "(", "$", "command", ",", "$", "entity", ")", "{", "$", "commandClass", "=", "$", "this", "->", "customCommands", "[", "$", "command", "]", ";", "if", "(", "$", "this", "->", "manager", "->", "isTraversable", ...
Execute a custom command on an Entity. @param string $command @param mixed|Collection|array $entity @throws \InvalidArgumentException @throws MappingException @return mixed
[ "Execute", "a", "custom", "command", "on", "an", "Entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L701-L712
analogueorm/analogue
src/System/Mapper.php
Mapper.executeSingleCustomCommand
protected function executeSingleCustomCommand($commandClass, $entity) { $this->checkEntityType($entity); $instance = new $commandClass($this->aggregate($entity), $this->newQueryBuilder()); return $instance->execute(); }
php
protected function executeSingleCustomCommand($commandClass, $entity) { $this->checkEntityType($entity); $instance = new $commandClass($this->aggregate($entity), $this->newQueryBuilder()); return $instance->execute(); }
[ "protected", "function", "executeSingleCustomCommand", "(", "$", "commandClass", ",", "$", "entity", ")", "{", "$", "this", "->", "checkEntityType", "(", "$", "entity", ")", ";", "$", "instance", "=", "new", "$", "commandClass", "(", "$", "this", "->", "ag...
Execute a single command instance. @param string $commandClass @param mixed $entity @throws \InvalidArgumentException @throws MappingException @return mixed
[ "Execute", "a", "single", "command", "instance", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Mapper.php#L725-L732
analogueorm/analogue
src/Relationships/MorphMany.php
MorphMany.getResults
public function getResults($relation) { $results = $this->query->get(); $this->cacheRelation($results, $relation); return $results; }
php
public function getResults($relation) { $results = $this->query->get(); $this->cacheRelation($results, $relation); return $results; }
[ "public", "function", "getResults", "(", "$", "relation", ")", "{", "$", "results", "=", "$", "this", "->", "query", "->", "get", "(", ")", ";", "$", "this", "->", "cacheRelation", "(", "$", "results", ",", "$", "relation", ")", ";", "return", "$", ...
Get the results of the relationship. @param $relation @return mixed
[ "Get", "the", "results", "of", "the", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphMany.php#L14-L21
analogueorm/analogue
src/Analogue.php
Analogue.boot
public function boot() { if (static::$booted) { return $this; } $dispatcher = new Dispatcher(); $connectionProvider = new CapsuleConnectionProvider(static::$capsule); $illuminate = new IlluminateDriver($connectionProvider); $driverManager = new DriverM...
php
public function boot() { if (static::$booted) { return $this; } $dispatcher = new Dispatcher(); $connectionProvider = new CapsuleConnectionProvider(static::$capsule); $illuminate = new IlluminateDriver($connectionProvider); $driverManager = new DriverM...
[ "public", "function", "boot", "(", ")", "{", "if", "(", "static", "::", "$", "booted", ")", "{", "return", "$", "this", ";", "}", "$", "dispatcher", "=", "new", "Dispatcher", "(", ")", ";", "$", "connectionProvider", "=", "new", "CapsuleConnectionProvide...
Boot Analogue. @return Analogue
[ "Boot", "Analogue", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Analogue.php#L61-L84
analogueorm/analogue
src/Relationships/EmbedsMany.php
EmbedsMany.matchSingleResult
public function matchSingleResult(array $attributes) : array { $column = $this->relation; if (!$this->asArray) { throw new MappingException("column '$column' should be of type array or json"); } return $this->matchAsArray($attributes); }
php
public function matchSingleResult(array $attributes) : array { $column = $this->relation; if (!$this->asArray) { throw new MappingException("column '$column' should be of type array or json"); } return $this->matchAsArray($attributes); }
[ "public", "function", "matchSingleResult", "(", "array", "$", "attributes", ")", ":", "array", "{", "$", "column", "=", "$", "this", "->", "relation", ";", "if", "(", "!", "$", "this", "->", "asArray", ")", "{", "throw", "new", "MappingException", "(", ...
Match a single database row's attributes to a single object, and return the updated attributes. @param array $attributes @throws MappingException @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/EmbedsMany.php#L20-L29
analogueorm/analogue
src/Relationships/EmbedsMany.php
EmbedsMany.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)) { $attributes[$key] = $this->asJson ? json_encode([]) : [];...
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)) { $attributes[$key] = $this->asJson ? json_encode([]) : [];...
[ "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/EmbedsMany.php#L41-L62
analogueorm/analogue
src/Relationships/EmbedsMany.php
EmbedsMany.buildEmbeddedCollection
protected function buildEmbeddedCollection(array $rows): Collection { return collect($rows)->map(function ($attributes) { return $this->buildEmbeddedObject($attributes); }); }
php
protected function buildEmbeddedCollection(array $rows): Collection { return collect($rows)->map(function ($attributes) { return $this->buildEmbeddedObject($attributes); }); }
[ "protected", "function", "buildEmbeddedCollection", "(", "array", "$", "rows", ")", ":", "Collection", "{", "return", "collect", "(", "$", "rows", ")", "->", "map", "(", "function", "(", "$", "attributes", ")", "{", "return", "$", "this", "->", "buildEmbed...
Build an embedded collection and returns it. @param array $rows @return Collection
[ "Build", "an", "embedded", "collection", "and", "returns", "it", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsMany.php#L71-L76
analogueorm/analogue
src/Relationships/EmbedsMany.php
EmbedsMany.normalizeAsArray
protected function normalizeAsArray($objects) : array { $key = $this->relation; if (!is_array($objects) && !$objects instanceof Collection) { throw new MappingException("column '$key' should be of type array or collection"); } if ($objects instanceof Collection) { ...
php
protected function normalizeAsArray($objects) : array { $key = $this->relation; if (!is_array($objects) && !$objects instanceof Collection) { throw new MappingException("column '$key' should be of type array or collection"); } if ($objects instanceof Collection) { ...
[ "protected", "function", "normalizeAsArray", "(", "$", "objects", ")", ":", "array", "{", "$", "key", "=", "$", "this", "->", "relation", ";", "if", "(", "!", "is_array", "(", "$", "objects", ")", "&&", "!", "$", "objects", "instanceof", "Collection", ...
Normalize object as array containing raw attributes. @param mixed $objects @throws MappingException @return array
[ "Normalize", "object", "as", "array", "containing", "raw", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/EmbedsMany.php#L105-L129
analogueorm/analogue
src/Plugins/Timestamps/TimestampsPlugin.php
TimestampsPlugin.register
public function register() { $this->manager->registerGlobalEvent('initialized', function ($event, $payload = null) { // Cross Compatible Event handling with 5.3 // TODO : find a replacement event handler if (is_null($payload)) { $mapper = $event; ...
php
public function register() { $this->manager->registerGlobalEvent('initialized', function ($event, $payload = null) { // Cross Compatible Event handling with 5.3 // TODO : find a replacement event handler if (is_null($payload)) { $mapper = $event; ...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "manager", "->", "registerGlobalEvent", "(", "'initialized'", ",", "function", "(", "$", "event", ",", "$", "payload", "=", "null", ")", "{", "// Cross Compatible Event handling with 5.3", "// T...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Plugins/Timestamps/TimestampsPlugin.php#L18-L60
analogueorm/analogue
src/Plugins/Timestamps/TimestampsPlugin.php
TimestampsPlugin.getMappable
protected function getMappable($entity) : InternallyMappable { if ($entity instanceof InternallyMappable) { return $entity; } $factory = new Factory(); $wrappedEntity = $factory->make($entity); return $wrappedEntity; }
php
protected function getMappable($entity) : InternallyMappable { if ($entity instanceof InternallyMappable) { return $entity; } $factory = new Factory(); $wrappedEntity = $factory->make($entity); return $wrappedEntity; }
[ "protected", "function", "getMappable", "(", "$", "entity", ")", ":", "InternallyMappable", "{", "if", "(", "$", "entity", "instanceof", "InternallyMappable", ")", "{", "return", "$", "entity", ";", "}", "$", "factory", "=", "new", "Factory", "(", ")", ";"...
Return internally mappable if not mappable. @param mixed $entity @return InternallyMappable
[ "Return", "internally", "mappable", "if", "not", "mappable", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Plugins/Timestamps/TimestampsPlugin.php#L69-L79
analogueorm/analogue
src/System/Aggregate.php
Aggregate.parseRelationships
protected function parseRelationships() { foreach ($this->entityMap->getSingleRelationships() as $relation) { $this->parseSingleRelationship($relation); } foreach ($this->entityMap->getManyRelationships() as $relation) { $this->parseManyRelationship($relation); ...
php
protected function parseRelationships() { foreach ($this->entityMap->getSingleRelationships() as $relation) { $this->parseSingleRelationship($relation); } foreach ($this->entityMap->getManyRelationships() as $relation) { $this->parseManyRelationship($relation); ...
[ "protected", "function", "parseRelationships", "(", ")", "{", "foreach", "(", "$", "this", "->", "entityMap", "->", "getSingleRelationships", "(", ")", "as", "$", "relation", ")", "{", "$", "this", "->", "parseSingleRelationship", "(", "$", "relation", ")", ...
Parse Every relationships defined on the entity. @throws MappingException @return void
[ "Parse", "Every", "relationships", "defined", "on", "the", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L124-L133
analogueorm/analogue
src/System/Aggregate.php
Aggregate.parseForCommonValues
protected function parseForCommonValues($relation) { if (!$this->hasAttribute($relation)) { // If no attribute exists for this relationships // we'll make it a simple empty array. This will // save us from constantly checking for the attributes // actual exist...
php
protected function parseForCommonValues($relation) { if (!$this->hasAttribute($relation)) { // If no attribute exists for this relationships // we'll make it a simple empty array. This will // save us from constantly checking for the attributes // actual exist...
[ "protected", "function", "parseForCommonValues", "(", "$", "relation", ")", "{", "if", "(", "!", "$", "this", "->", "hasAttribute", "(", "$", "relation", ")", ")", "{", "// If no attribute exists for this relationships", "// we'll make it a simple empty array. This will",...
Parse for values common to single & many relations. @param string $relation @throws MappingException @return mixed|bool
[ "Parse", "for", "values", "common", "to", "single", "&", "many", "relations", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L144-L171
analogueorm/analogue
src/System/Aggregate.php
Aggregate.parseSingleRelationship
protected function parseSingleRelationship(string $relation): bool { if (!$value = $this->parseForCommonValues($relation)) { return true; } if ($value instanceof Collection || is_array($value) || $value instanceof CollectionProxy) { throw new MappingException("Entity...
php
protected function parseSingleRelationship(string $relation): bool { if (!$value = $this->parseForCommonValues($relation)) { return true; } if ($value instanceof Collection || is_array($value) || $value instanceof CollectionProxy) { throw new MappingException("Entity...
[ "protected", "function", "parseSingleRelationship", "(", "string", "$", "relation", ")", ":", "bool", "{", "if", "(", "!", "$", "value", "=", "$", "this", "->", "parseForCommonValues", "(", "$", "relation", ")", ")", "{", "return", "true", ";", "}", "if"...
Parse a 'single' relationship. @param string $relation @throws MappingException @return bool
[ "Parse", "a", "single", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L182-L223
analogueorm/analogue
src/System/Aggregate.php
Aggregate.isParentOrRoot
protected function isParentOrRoot($value): bool { $id = spl_object_hash($value); $root = $this->root ? $this->root->getWrappedEntity()->getObject() : null; $parent = $this->parent ? $this->parent->getWrappedEntity()->getObject() : null; if ($parent && (spl_object_hash($parent) == $i...
php
protected function isParentOrRoot($value): bool { $id = spl_object_hash($value); $root = $this->root ? $this->root->getWrappedEntity()->getObject() : null; $parent = $this->parent ? $this->parent->getWrappedEntity()->getObject() : null; if ($parent && (spl_object_hash($parent) == $i...
[ "protected", "function", "isParentOrRoot", "(", "$", "value", ")", ":", "bool", "{", "$", "id", "=", "spl_object_hash", "(", "$", "value", ")", ";", "$", "root", "=", "$", "this", "->", "root", "?", "$", "this", "->", "root", "->", "getWrappedEntity", ...
Check if value isn't parent or root in the aggregate. @param mixed @return bool
[ "Check", "if", "value", "isn", "t", "parent", "or", "root", "in", "the", "aggregate", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L232-L247
analogueorm/analogue
src/System/Aggregate.php
Aggregate.parseManyRelationship
protected function parseManyRelationship(string $relation): bool { if (!$value = $this->parseForCommonValues($relation)) { return true; } if (is_array($value) || (!$value instanceof CollectionProxy && $value instanceof Collection)) { $this->needSync[] = $relation; ...
php
protected function parseManyRelationship(string $relation): bool { if (!$value = $this->parseForCommonValues($relation)) { return true; } if (is_array($value) || (!$value instanceof CollectionProxy && $value instanceof Collection)) { $this->needSync[] = $relation; ...
[ "protected", "function", "parseManyRelationship", "(", "string", "$", "relation", ")", ":", "bool", "{", "if", "(", "!", "$", "value", "=", "$", "this", "->", "parseForCommonValues", "(", "$", "relation", ")", ")", "{", "return", "true", ";", "}", "if", ...
Parse a 'many' relationship. @param string $relation @throws MappingException @return bool
[ "Parse", "a", "many", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L258-L289
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getRelationshipValue
protected function getRelationshipValue(string $relation) { $value = $this->getEntityAttribute($relation); if (is_scalar($value)) { throw new MappingException("Entity's attribute $relation should be array, object, collection or null"); } return $value; }
php
protected function getRelationshipValue(string $relation) { $value = $this->getEntityAttribute($relation); if (is_scalar($value)) { throw new MappingException("Entity's attribute $relation should be array, object, collection or null"); } return $value; }
[ "protected", "function", "getRelationshipValue", "(", "string", "$", "relation", ")", "{", "$", "value", "=", "$", "this", "->", "getEntityAttribute", "(", "$", "relation", ")", ";", "if", "(", "is_scalar", "(", "$", "value", ")", ")", "{", "throw", "new...
Return Entity's relationship attribute. @param string $relation @throws MappingException @return mixed
[ "Return", "Entity", "s", "relationship", "attribute", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L300-L309
analogueorm/analogue
src/System/Aggregate.php
Aggregate.createSubAggregates
protected function createSubAggregates($entities, string $relation): array { $aggregates = []; foreach ($entities as $entity) { $aggregates[] = $this->createSubAggregate($entity, $relation); } return $aggregates; }
php
protected function createSubAggregates($entities, string $relation): array { $aggregates = []; foreach ($entities as $entity) { $aggregates[] = $this->createSubAggregate($entity, $relation); } return $aggregates; }
[ "protected", "function", "createSubAggregates", "(", "$", "entities", ",", "string", "$", "relation", ")", ":", "array", "{", "$", "aggregates", "=", "[", "]", ";", "foreach", "(", "$", "entities", "as", "$", "entity", ")", "{", "$", "aggregates", "[", ...
Create a child, aggregated entity. @param mixed $entities @param string $relation @return array
[ "Create", "a", "child", "aggregated", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L319-L328
analogueorm/analogue
src/System/Aggregate.php
Aggregate.createSubAggregate
protected function createSubAggregate($entity, string $relation): self { // If root isn't defined, then this is the Aggregate Root $root = is_null($this->root) ? $this : $this->root; return new self($entity, $this, $relation, $root); }
php
protected function createSubAggregate($entity, string $relation): self { // If root isn't defined, then this is the Aggregate Root $root = is_null($this->root) ? $this : $this->root; return new self($entity, $this, $relation, $root); }
[ "protected", "function", "createSubAggregate", "(", "$", "entity", ",", "string", "$", "relation", ")", ":", "self", "{", "// If root isn't defined, then this is the Aggregate Root", "$", "root", "=", "is_null", "(", "$", "this", "->", "root", ")", "?", "$", "th...
Create a related subAggregate. @param mixed $entity @param string $relation @throws MappingException @return Aggregate
[ "Create", "a", "related", "subAggregate", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L340-L346
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getEntityKeyValue
public function getEntityKeyValue() { $keyValue = $this->wrappedEntity->getEntityKeyValue(); if ($keyValue instanceof ObjectId) { $keyValue = (string) $keyValue; } return $keyValue; }
php
public function getEntityKeyValue() { $keyValue = $this->wrappedEntity->getEntityKeyValue(); if ($keyValue instanceof ObjectId) { $keyValue = (string) $keyValue; } return $keyValue; }
[ "public", "function", "getEntityKeyValue", "(", ")", "{", "$", "keyValue", "=", "$", "this", "->", "wrappedEntity", "->", "getEntityKeyValue", "(", ")", ";", "if", "(", "$", "keyValue", "instanceof", "ObjectId", ")", "{", "$", "keyValue", "=", "(", "string...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L377-L386
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getRelationship
public function getRelationship(string $name): array { if (array_key_exists($name, $this->relationships)) { return $this->relationships[$name]; } return []; }
php
public function getRelationship(string $name): array { if (array_key_exists($name, $this->relationships)) { return $this->relationships[$name]; } return []; }
[ "public", "function", "getRelationship", "(", "string", "$", "name", ")", ":", "array", "{", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "relationships", ")", ")", "{", "return", "$", "this", "->", "relationships", "[", "$", ...
Get a relationship as an aggregated entities' array. @param string $name @return array
[ "Get", "a", "relationship", "as", "an", "aggregated", "entities", "array", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L413-L420
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getNonExistingRelated
public function getNonExistingRelated(array $relationships): array { $nonExisting = []; foreach ($relationships as $relation) { if ($this->hasAttribute($relation) && array_key_exists($relation, $this->relationships)) { $nonExisting = array_merge($nonExisting, $this->getN...
php
public function getNonExistingRelated(array $relationships): array { $nonExisting = []; foreach ($relationships as $relation) { if ($this->hasAttribute($relation) && array_key_exists($relation, $this->relationships)) { $nonExisting = array_merge($nonExisting, $this->getN...
[ "public", "function", "getNonExistingRelated", "(", "array", "$", "relationships", ")", ":", "array", "{", "$", "nonExisting", "=", "[", "]", ";", "foreach", "(", "$", "relationships", "as", "$", "relation", ")", "{", "if", "(", "$", "this", "->", "hasAt...
Get Non existing related entities from several relationships. @param array $relationships @return array
[ "Get", "Non", "existing", "related", "entities", "from", "several", "relationships", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L439-L450
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getNonExistingFromRelation
protected function getNonExistingFromRelation(string $relation): array { $nonExisting = []; foreach ($this->relationships[$relation] as $aggregate) { if (!$aggregate->exists()) { $nonExisting[] = $aggregate; } } return $nonExisting; }
php
protected function getNonExistingFromRelation(string $relation): array { $nonExisting = []; foreach ($this->relationships[$relation] as $aggregate) { if (!$aggregate->exists()) { $nonExisting[] = $aggregate; } } return $nonExisting; }
[ "protected", "function", "getNonExistingFromRelation", "(", "string", "$", "relation", ")", ":", "array", "{", "$", "nonExisting", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "relationships", "[", "$", "relation", "]", "as", "$", "aggregate", ")...
Get non-existing related entities from a single relation. @param string $relation @return array
[ "Get", "non", "-", "existing", "related", "entities", "from", "a", "single", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L459-L470
analogueorm/analogue
src/System/Aggregate.php
Aggregate.syncRelationships
public function syncRelationships(array $relationships) { foreach ($relationships as $relation) { if (in_array($relation, $this->needSync)) { $this->synchronize($relation); } } }
php
public function syncRelationships(array $relationships) { foreach ($relationships as $relation) { if (in_array($relation, $this->needSync)) { $this->synchronize($relation); } } }
[ "public", "function", "syncRelationships", "(", "array", "$", "relationships", ")", "{", "foreach", "(", "$", "relationships", "as", "$", "relation", ")", "{", "if", "(", "in_array", "(", "$", "relation", ",", "$", "this", "->", "needSync", ")", ")", "{"...
Synchronize relationships if needed. @param array @return void
[ "Synchronize", "relationships", "if", "needed", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L479-L486
analogueorm/analogue
src/System/Aggregate.php
Aggregate.synchronize
protected function synchronize(string $relation) { $actualContent = $this->relationships[$relation]; $relationshipObject = $this->entityMap->$relation($this->getEntityObject()); $relationshipObject->setParent($this->wrappedEntity); $relationshipObject->sync($actualContent); }
php
protected function synchronize(string $relation) { $actualContent = $this->relationships[$relation]; $relationshipObject = $this->entityMap->$relation($this->getEntityObject()); $relationshipObject->setParent($this->wrappedEntity); $relationshipObject->sync($actualContent); }
[ "protected", "function", "synchronize", "(", "string", "$", "relation", ")", "{", "$", "actualContent", "=", "$", "this", "->", "relationships", "[", "$", "relation", "]", ";", "$", "relationshipObject", "=", "$", "this", "->", "entityMap", "->", "$", "rel...
Synchronize a relationship attribute. @param string $relation @return void
[ "Synchronize", "a", "relationship", "attribute", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L495-L502
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getMissingEntities
public function getMissingEntities(string $relation): array { $cachedRelations = $this->getCachedAttribute($relation); if (is_null($cachedRelations)) { return []; } $missing = []; foreach ($cachedRelations as $hash) { if (!$this->getRelatedAggregate...
php
public function getMissingEntities(string $relation): array { $cachedRelations = $this->getCachedAttribute($relation); if (is_null($cachedRelations)) { return []; } $missing = []; foreach ($cachedRelations as $hash) { if (!$this->getRelatedAggregate...
[ "public", "function", "getMissingEntities", "(", "string", "$", "relation", ")", ":", "array", "{", "$", "cachedRelations", "=", "$", "this", "->", "getCachedAttribute", "(", "$", "relation", ")", ";", "if", "(", "is_null", "(", "$", "cachedRelations", ")", ...
Returns an array of Missing related Entities for the given $relation. @param string $relation @return array
[ "Returns", "an", "array", "of", "Missing", "related", "Entities", "for", "the", "given", "$relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L512-L529
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getDirtyRelationships
public function getDirtyRelationships(): array { $dirtyAggregates = []; foreach ($this->relationships as $relation) { foreach ($relation as $aggregate) { if (!$aggregate->exists() || $aggregate->isDirty() || count($aggregate->getDirtyRelationships()) > 0) { ...
php
public function getDirtyRelationships(): array { $dirtyAggregates = []; foreach ($this->relationships as $relation) { foreach ($relation as $aggregate) { if (!$aggregate->exists() || $aggregate->isDirty() || count($aggregate->getDirtyRelationships()) > 0) { ...
[ "public", "function", "getDirtyRelationships", "(", ")", ":", "array", "{", "$", "dirtyAggregates", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "relationships", "as", "$", "relation", ")", "{", "foreach", "(", "$", "relation", "as", "$", "aggr...
Get Relationships who have dirty attributes / dirty relationships. @return array
[ "Get", "Relationships", "who", "have", "dirty", "attributes", "/", "dirty", "relationships", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L536-L549
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getRawAttributes
public function getRawAttributes(): array { $attributes = $this->wrappedEntity->getEntityAttributes(); foreach ($this->entityMap->getNonEmbeddedRelationships() as $relation) { unset($attributes[$relation]); } if ($this->entityMap->getInheritanceType() == 'single_table')...
php
public function getRawAttributes(): array { $attributes = $this->wrappedEntity->getEntityAttributes(); foreach ($this->entityMap->getNonEmbeddedRelationships() as $relation) { unset($attributes[$relation]); } if ($this->entityMap->getInheritanceType() == 'single_table')...
[ "public", "function", "getRawAttributes", "(", ")", ":", "array", "{", "$", "attributes", "=", "$", "this", "->", "wrappedEntity", "->", "getEntityAttributes", "(", ")", ";", "foreach", "(", "$", "this", "->", "entityMap", "->", "getNonEmbeddedRelationships", ...
Get Raw Entity's attributes, as they are represented in the database, including value objects, foreign keys, and discriminator column. @return array
[ "Get", "Raw", "Entity", "s", "attributes", "as", "they", "are", "represented", "in", "the", "database", "including", "value", "objects", "foreign", "keys", "and", "discriminator", "column", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L568-L587
analogueorm/analogue
src/System/Aggregate.php
Aggregate.mergeForeignKeysWithAttributes
protected function mergeForeignKeysWithAttributes(array $foreignKeys, array $attributes): array { $cachedAttributes = $this->getCachedRawAttributes(); foreach ($foreignKeys as $fkAttributeKey => $fkAttributeValue) { // FK doesn't exist in attributes => we set it if (!array_k...
php
protected function mergeForeignKeysWithAttributes(array $foreignKeys, array $attributes): array { $cachedAttributes = $this->getCachedRawAttributes(); foreach ($foreignKeys as $fkAttributeKey => $fkAttributeValue) { // FK doesn't exist in attributes => we set it if (!array_k...
[ "protected", "function", "mergeForeignKeysWithAttributes", "(", "array", "$", "foreignKeys", ",", "array", "$", "attributes", ")", ":", "array", "{", "$", "cachedAttributes", "=", "$", "this", "->", "getCachedRawAttributes", "(", ")", ";", "foreach", "(", "$", ...
Merge foreign keys and attributes by comparing their current value to the cache, and guess the user intent. @param array $foreignKeys @param array $attributes @return array
[ "Merge", "foreign", "keys", "and", "attributes", "by", "comparing", "their", "current", "value", "to", "the", "cache", "and", "guess", "the", "user", "intent", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L598-L634
analogueorm/analogue
src/System/Aggregate.php
Aggregate.addDiscriminatorColumn
protected function addDiscriminatorColumn(array $attributes): array { $discriminatorColumn = $this->entityMap->getDiscriminatorColumn(); $entityClass = $this->entityMap->getClass(); if (!array_key_exists($discriminatorColumn, $attributes)) { // Use key if present in discriminato...
php
protected function addDiscriminatorColumn(array $attributes): array { $discriminatorColumn = $this->entityMap->getDiscriminatorColumn(); $entityClass = $this->entityMap->getClass(); if (!array_key_exists($discriminatorColumn, $attributes)) { // Use key if present in discriminato...
[ "protected", "function", "addDiscriminatorColumn", "(", "array", "$", "attributes", ")", ":", "array", "{", "$", "discriminatorColumn", "=", "$", "this", "->", "entityMap", "->", "getDiscriminatorColumn", "(", ")", ";", "$", "entityClass", "=", "$", "this", "-...
Add Discriminator Column if it doesn't exist on the actual entity. @param array $attributes @return array
[ "Add", "Discriminator", "Column", "if", "it", "doesn", "t", "exist", "on", "the", "actual", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L643-L663
analogueorm/analogue
src/System/Aggregate.php
Aggregate.flattenEmbeddables
protected function flattenEmbeddables(array $attributes): array { // TODO : deprecate old implementation $embeddables = $this->entityMap->getEmbeddables(); foreach ($embeddables as $localKey => $embed) { // Retrieve the value object from the entity's attributes $valu...
php
protected function flattenEmbeddables(array $attributes): array { // TODO : deprecate old implementation $embeddables = $this->entityMap->getEmbeddables(); foreach ($embeddables as $localKey => $embed) { // Retrieve the value object from the entity's attributes $valu...
[ "protected", "function", "flattenEmbeddables", "(", "array", "$", "attributes", ")", ":", "array", "{", "// TODO : deprecate old implementation", "$", "embeddables", "=", "$", "this", "->", "entityMap", "->", "getEmbeddables", "(", ")", ";", "foreach", "(", "$", ...
Convert Value Objects to raw db attributes. @param array $attributes @return array
[ "Convert", "Value", "Objects", "to", "raw", "db", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L672-L722
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getCachedRawAttributes
protected function getCachedRawAttributes(array $columns = null): array { $cachedAttributes = $this->getCache()->get($this->getEntityKeyValue()); if (is_null($columns)) { return $cachedAttributes; } return array_only($cachedAttributes, $columns); }
php
protected function getCachedRawAttributes(array $columns = null): array { $cachedAttributes = $this->getCache()->get($this->getEntityKeyValue()); if (is_null($columns)) { return $cachedAttributes; } return array_only($cachedAttributes, $columns); }
[ "protected", "function", "getCachedRawAttributes", "(", "array", "$", "columns", "=", "null", ")", ":", "array", "{", "$", "cachedAttributes", "=", "$", "this", "->", "getCache", "(", ")", "->", "get", "(", "$", "this", "->", "getEntityKeyValue", "(", ")",...
Return's entity raw attributes in the state they were at last query. @param array|null $columns @return array
[ "Return", "s", "entity", "raw", "attributes", "in", "the", "state", "they", "were", "at", "last", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L732-L741
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getCachedAttribute
protected function getCachedAttribute($key) { $cachedAttributes = $this->getCache()->get($this->getEntityKeyValue()); if (array_key_exists($key, $cachedAttributes)) { return $cachedAttributes[$key]; } }
php
protected function getCachedAttribute($key) { $cachedAttributes = $this->getCache()->get($this->getEntityKeyValue()); if (array_key_exists($key, $cachedAttributes)) { return $cachedAttributes[$key]; } }
[ "protected", "function", "getCachedAttribute", "(", "$", "key", ")", "{", "$", "cachedAttributes", "=", "$", "this", "->", "getCache", "(", ")", "->", "get", "(", "$", "this", "->", "getEntityKeyValue", "(", ")", ")", ";", "if", "(", "array_key_exists", ...
Return a single attribute from the cache. @param string $key @return mixed|null
[ "Return", "a", "single", "attribute", "from", "the", "cache", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L750-L757
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getForeignKeyAttributes
public function getForeignKeyAttributes(): array { $foreignKeys = []; foreach ($this->entityMap->getLocalRelationships() as $relation) { // If the actual relationship is a non-loaded proxy, we'll simply retrieve // the foreign key pair without parsing the actual object. This...
php
public function getForeignKeyAttributes(): array { $foreignKeys = []; foreach ($this->entityMap->getLocalRelationships() as $relation) { // If the actual relationship is a non-loaded proxy, we'll simply retrieve // the foreign key pair without parsing the actual object. This...
[ "public", "function", "getForeignKeyAttributes", "(", ")", ":", "array", "{", "$", "foreignKeys", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "entityMap", "->", "getLocalRelationships", "(", ")", "as", "$", "relation", ")", "{", "// If the actual ...
Convert related Entity's attributes to foreign keys. @return array
[ "Convert", "related", "Entity", "s", "attributes", "to", "foreign", "keys", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L764-L792
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getNullForeignKeyFromRelation
protected function getNullForeignKeyFromRelation(string $relation): array { $key = $this->entityMap->getLocalKeys($relation); if (is_array($key)) { return $this->entityMap->getEmptyValueForLocalKey($relation); } if (is_null($key)) { throw new MappingExceptio...
php
protected function getNullForeignKeyFromRelation(string $relation): array { $key = $this->entityMap->getLocalKeys($relation); if (is_array($key)) { return $this->entityMap->getEmptyValueForLocalKey($relation); } if (is_null($key)) { throw new MappingExceptio...
[ "protected", "function", "getNullForeignKeyFromRelation", "(", "string", "$", "relation", ")", ":", "array", "{", "$", "key", "=", "$", "this", "->", "entityMap", "->", "getLocalKeys", "(", "$", "relation", ")", ";", "if", "(", "is_array", "(", "$", "key",...
Get a null foreign key value pair for an empty relationship. @param string $relation @throws MappingException @return array
[ "Get", "a", "null", "foreign", "key", "value", "pair", "for", "an", "empty", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L803-L818
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getForeignKeyAttributesFromRelation
protected function getForeignKeyAttributesFromRelation(string $relation): array { // Call Relationship's method $relationship = $this->entityMap->$relation($this->getEntityObject()); $relatedAggregate = $this->relationships[$relation][0]; return $relationship->getForeignKeyValuePai...
php
protected function getForeignKeyAttributesFromRelation(string $relation): array { // Call Relationship's method $relationship = $this->entityMap->$relation($this->getEntityObject()); $relatedAggregate = $this->relationships[$relation][0]; return $relationship->getForeignKeyValuePai...
[ "protected", "function", "getForeignKeyAttributesFromRelation", "(", "string", "$", "relation", ")", ":", "array", "{", "// Call Relationship's method", "$", "relationship", "=", "$", "this", "->", "entityMap", "->", "$", "relation", "(", "$", "this", "->", "getEn...
Return an associative array containing the key-value pair(s) from the related entity. @param string $relation @return array
[ "Return", "an", "associative", "array", "containing", "the", "key", "-", "value", "pair", "(", "s", ")", "from", "the", "related", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L828-L836
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getForeignKeyAttributesFromNonLoadedRelation
protected function getForeignKeyAttributesFromNonLoadedRelation(string $relation): array { $keys = $this->entityMap->getLocalKeys($relation); // We'll treat single and composite keys (polymorphic) the same way. if (!is_array($keys)) { $keys = [$keys]; } $foreign...
php
protected function getForeignKeyAttributesFromNonLoadedRelation(string $relation): array { $keys = $this->entityMap->getLocalKeys($relation); // We'll treat single and composite keys (polymorphic) the same way. if (!is_array($keys)) { $keys = [$keys]; } $foreign...
[ "protected", "function", "getForeignKeyAttributesFromNonLoadedRelation", "(", "string", "$", "relation", ")", ":", "array", "{", "$", "keys", "=", "$", "this", "->", "entityMap", "->", "getLocalKeys", "(", "$", "relation", ")", ";", "// We'll treat single and compos...
Return an associative array containing the key-value pair(s) from the foreign key attribute. @param string $relation @return array
[ "Return", "an", "associative", "array", "containing", "the", "key", "-", "value", "pair", "(", "s", ")", "from", "the", "foreign", "key", "attribute", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L846-L862
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getForeignKeyAttributesFromParent
protected function getForeignKeyAttributesFromParent(): array { $parentMap = $this->parent->getEntityMap(); $parentForeignRelations = $parentMap->getForeignRelationships(); $parentPivotRelations = $parentMap->getPivotRelationships(); // The parentRelation is the name of the relatio...
php
protected function getForeignKeyAttributesFromParent(): array { $parentMap = $this->parent->getEntityMap(); $parentForeignRelations = $parentMap->getForeignRelationships(); $parentPivotRelations = $parentMap->getPivotRelationships(); // The parentRelation is the name of the relatio...
[ "protected", "function", "getForeignKeyAttributesFromParent", "(", ")", ":", "array", "{", "$", "parentMap", "=", "$", "this", "->", "parent", "->", "getEntityMap", "(", ")", ";", "$", "parentForeignRelations", "=", "$", "parentMap", "->", "getForeignRelationships...
Get foreign key attribute(s) from a parent entity in this aggregate context. @return array
[ "Get", "foreign", "key", "attribute", "(", "s", ")", "from", "a", "parent", "entity", "in", "this", "aggregate", "context", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L870-L893
analogueorm/analogue
src/System/Aggregate.php
Aggregate.updatePivotRecords
public function updatePivotRecords() { $pivots = $this->entityMap->getPivotRelationships(); foreach ($pivots as $pivot) { if (array_key_exists($pivot, $this->relationships)) { $this->updatePivotRelation($pivot); } } }
php
public function updatePivotRecords() { $pivots = $this->entityMap->getPivotRelationships(); foreach ($pivots as $pivot) { if (array_key_exists($pivot, $this->relationships)) { $this->updatePivotRelation($pivot); } } }
[ "public", "function", "updatePivotRecords", "(", ")", "{", "$", "pivots", "=", "$", "this", "->", "entityMap", "->", "getPivotRelationships", "(", ")", ";", "foreach", "(", "$", "pivots", "as", "$", "pivot", ")", "{", "if", "(", "array_key_exists", "(", ...
Update Pivot records on loaded relationships, by comparing the values from the Entity Cache to the actual relationship inside the aggregated entity. @return void
[ "Update", "Pivot", "records", "on", "loaded", "relationships", "by", "comparing", "the", "values", "from", "the", "Entity", "Cache", "to", "the", "actual", "relationship", "inside", "the", "aggregated", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L902-L911
analogueorm/analogue
src/System/Aggregate.php
Aggregate.updatePivotRelation
protected function updatePivotRelation(string $relation) { $hashes = $this->getEntityHashesFromRelation($relation); $cachedAttributes = $this->getCachedRawAttributes(); if (array_key_exists($relation, $cachedAttributes)) { // Compare the two array of hashes to find out existing...
php
protected function updatePivotRelation(string $relation) { $hashes = $this->getEntityHashesFromRelation($relation); $cachedAttributes = $this->getCachedRawAttributes(); if (array_key_exists($relation, $cachedAttributes)) { // Compare the two array of hashes to find out existing...
[ "protected", "function", "updatePivotRelation", "(", "string", "$", "relation", ")", "{", "$", "hashes", "=", "$", "this", "->", "getEntityHashesFromRelation", "(", "$", "relation", ")", ";", "$", "cachedAttributes", "=", "$", "this", "->", "getCachedRawAttribut...
Update Single pivot relationship. @param string $relation @return void
[ "Update", "Single", "pivot", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L920-L947
analogueorm/analogue
src/System/Aggregate.php
Aggregate.updatePivotIfDirty
protected function updatePivotIfDirty(string $pivotHash, string $relation) { $aggregate = $this->getRelatedAggregateFromHash($pivotHash, $relation); if ($aggregate->hasAttribute('pivot')) { $pivot = $aggregate->getEntityAttribute('pivot')->getEntityAttributes(); $cachedPivo...
php
protected function updatePivotIfDirty(string $pivotHash, string $relation) { $aggregate = $this->getRelatedAggregateFromHash($pivotHash, $relation); if ($aggregate->hasAttribute('pivot')) { $pivot = $aggregate->getEntityAttribute('pivot')->getEntityAttributes(); $cachedPivo...
[ "protected", "function", "updatePivotIfDirty", "(", "string", "$", "pivotHash", ",", "string", "$", "relation", ")", "{", "$", "aggregate", "=", "$", "this", "->", "getRelatedAggregateFromHash", "(", "$", "pivotHash", ",", "$", "relation", ")", ";", "if", "(...
Compare existing pivot record in cache and update it if the pivot attributes are dirty. @param string $pivotHash @param string $relation @return void
[ "Compare", "existing", "pivot", "record", "in", "cache", "and", "update", "it", "if", "the", "pivot", "attributes", "are", "dirty", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L958-L977
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getDirtyAttributes
protected function getDirtyAttributes(array $actual, array $cached): array { $dirty = []; foreach ($actual as $key => $value) { if (!$this->originalIsNumericallyEquivalent($value, $cached[$key])) { $dirty[$key] = $actual[$key]; } } return $di...
php
protected function getDirtyAttributes(array $actual, array $cached): array { $dirty = []; foreach ($actual as $key => $value) { if (!$this->originalIsNumericallyEquivalent($value, $cached[$key])) { $dirty[$key] = $actual[$key]; } } return $di...
[ "protected", "function", "getDirtyAttributes", "(", "array", "$", "actual", ",", "array", "$", "cached", ")", ":", "array", "{", "$", "dirty", "=", "[", "]", ";", "foreach", "(", "$", "actual", "as", "$", "key", "=>", "$", "value", ")", "{", "if", ...
Compare two attributes array and return dirty attributes. @param array $actual @param array $cached @return array
[ "Compare", "two", "attributes", "array", "and", "return", "dirty", "attributes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L987-L998
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getPivotAttributesFromCache
protected function getPivotAttributesFromCache(string $pivotHash, string $relation) { $cachedAttributes = $this->getCachedRawAttributes(); $cachedRelations = $cachedAttributes[$relation]; foreach ($cachedRelations as $cachedRelation) { if ($cachedRelation == $pivotHash) { ...
php
protected function getPivotAttributesFromCache(string $pivotHash, string $relation) { $cachedAttributes = $this->getCachedRawAttributes(); $cachedRelations = $cachedAttributes[$relation]; foreach ($cachedRelations as $cachedRelation) { if ($cachedRelation == $pivotHash) { ...
[ "protected", "function", "getPivotAttributesFromCache", "(", "string", "$", "pivotHash", ",", "string", "$", "relation", ")", "{", "$", "cachedAttributes", "=", "$", "this", "->", "getCachedRawAttributes", "(", ")", ";", "$", "cachedRelations", "=", "$", "cached...
@param string $pivotHash @param string $relation @return array|null
[ "@param", "string", "$pivotHash", "@param", "string", "$relation" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1006-L1017
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getRelatedAggregatesFromHashes
protected function getRelatedAggregatesFromHashes(array $hashes, string $relation): array { $related = []; foreach ($hashes as $hash) { $aggregate = $this->getRelatedAggregateFromHash($hash, $relation); if ($aggregate) { $related[] = $aggregate; ...
php
protected function getRelatedAggregatesFromHashes(array $hashes, string $relation): array { $related = []; foreach ($hashes as $hash) { $aggregate = $this->getRelatedAggregateFromHash($hash, $relation); if ($aggregate) { $related[] = $aggregate; ...
[ "protected", "function", "getRelatedAggregatesFromHashes", "(", "array", "$", "hashes", ",", "string", "$", "relation", ")", ":", "array", "{", "$", "related", "=", "[", "]", ";", "foreach", "(", "$", "hashes", "as", "$", "hash", ")", "{", "$", "aggregat...
Returns an array of related Aggregates from its entity hashes. @param array $hashes @param string $relation @return array
[ "Returns", "an", "array", "of", "related", "Aggregates", "from", "its", "entity", "hashes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1027-L1040
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getRelatedAggregateFromHash
protected function getRelatedAggregateFromHash(string $hash, string $relation) { foreach ($this->relationships[$relation] as $aggregate) { if ($aggregate->getEntityHash() == $hash) { return $aggregate; } } }
php
protected function getRelatedAggregateFromHash(string $hash, string $relation) { foreach ($this->relationships[$relation] as $aggregate) { if ($aggregate->getEntityHash() == $hash) { return $aggregate; } } }
[ "protected", "function", "getRelatedAggregateFromHash", "(", "string", "$", "hash", ",", "string", "$", "relation", ")", "{", "foreach", "(", "$", "this", "->", "relationships", "[", "$", "relation", "]", "as", "$", "aggregate", ")", "{", "if", "(", "$", ...
Get related aggregate from its hash. @param string $hash @param string $relation @return \Analogue\ORM\System\Aggregate|null
[ "Get", "related", "aggregate", "from", "its", "hash", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1050-L1057
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getEntityHashesFromRelation
protected function getEntityHashesFromRelation(string $relation): array { return array_map(function (Aggregate $aggregate) { return $aggregate->getEntityHash(); }, $this->relationships[$relation]); }
php
protected function getEntityHashesFromRelation(string $relation): array { return array_map(function (Aggregate $aggregate) { return $aggregate->getEntityHash(); }, $this->relationships[$relation]); }
[ "protected", "function", "getEntityHashesFromRelation", "(", "string", "$", "relation", ")", ":", "array", "{", "return", "array_map", "(", "function", "(", "Aggregate", "$", "aggregate", ")", "{", "return", "$", "aggregate", "->", "getEntityHash", "(", ")", "...
Return an array of Entity Hashes from a specific relation. @param string $relation @return array
[ "Return", "an", "array", "of", "Entity", "Hashes", "from", "a", "specific", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1066-L1071
analogueorm/analogue
src/System/Aggregate.php
Aggregate.isActualRelationships
protected function isActualRelationships(string $relation): bool { return array_key_exists($relation, $this->relationships) && count($this->relationships[$relation]) > 0; }
php
protected function isActualRelationships(string $relation): bool { return array_key_exists($relation, $this->relationships) && count($this->relationships[$relation]) > 0; }
[ "protected", "function", "isActualRelationships", "(", "string", "$", "relation", ")", ":", "bool", "{", "return", "array_key_exists", "(", "$", "relation", ",", "$", "this", "->", "relationships", ")", "&&", "count", "(", "$", "this", "->", "relationships", ...
Check the existence of an actual relationship. @param string $relation @return bool
[ "Check", "the", "existence", "of", "an", "actual", "relationship", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1080-L1084
analogueorm/analogue
src/System/Aggregate.php
Aggregate.getDirtyRawAttributes
public function getDirtyRawAttributes(): array { $attributes = $this->getRawAttributes(); $cachedAttributes = $this->getCachedRawAttributes(array_keys($attributes)); $dirty = []; foreach ($attributes as $key => $value) { if ($this->isActualRelation($key) || $key == 'pi...
php
public function getDirtyRawAttributes(): array { $attributes = $this->getRawAttributes(); $cachedAttributes = $this->getCachedRawAttributes(array_keys($attributes)); $dirty = []; foreach ($attributes as $key => $value) { if ($this->isActualRelation($key) || $key == 'pi...
[ "public", "function", "getDirtyRawAttributes", "(", ")", ":", "array", "{", "$", "attributes", "=", "$", "this", "->", "getRawAttributes", "(", ")", ";", "$", "cachedAttributes", "=", "$", "this", "->", "getCachedRawAttributes", "(", "array_keys", "(", "$", ...
Get Only Raw Entity attributes which have been modified since last query. @return array
[ "Get", "Only", "Raw", "Entity", "attributes", "which", "have", "been", "modified", "since", "last", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1102-L1124
analogueorm/analogue
src/System/Aggregate.php
Aggregate.isNonLoadedProxy
protected function isNonLoadedProxy(string $key): bool { $relation = $this->getEntityAttribute($key); return $relation instanceof ProxyInterface && !$relation->isProxyInitialized(); }
php
protected function isNonLoadedProxy(string $key): bool { $relation = $this->getEntityAttribute($key); return $relation instanceof ProxyInterface && !$relation->isProxyInitialized(); }
[ "protected", "function", "isNonLoadedProxy", "(", "string", "$", "key", ")", ":", "bool", "{", "$", "relation", "=", "$", "this", "->", "getEntityAttribute", "(", "$", "key", ")", ";", "return", "$", "relation", "instanceof", "ProxyInterface", "&&", "!", "...
Return true if attribute is a non-loaded proxy. @param string $key @return bool
[ "Return", "true", "if", "attribute", "is", "a", "non", "-", "loaded", "proxy", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1143-L1148
analogueorm/analogue
src/System/Aggregate.php
Aggregate.originalIsNumericallyEquivalent
protected function originalIsNumericallyEquivalent($current, $original): bool { return is_numeric($current) && is_numeric($original) && strcmp((string) $current, (string) $original) === 0; }
php
protected function originalIsNumericallyEquivalent($current, $original): bool { return is_numeric($current) && is_numeric($original) && strcmp((string) $current, (string) $original) === 0; }
[ "protected", "function", "originalIsNumericallyEquivalent", "(", "$", "current", ",", "$", "original", ")", ":", "bool", "{", "return", "is_numeric", "(", "$", "current", ")", "&&", "is_numeric", "(", "$", "original", ")", "&&", "strcmp", "(", "(", "string",...
Determine if the new and old values for a given key are numerically equivalent. @param $current @param $original @return bool
[ "Determine", "if", "the", "new", "and", "old", "values", "for", "a", "given", "key", "are", "numerically", "equivalent", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Aggregate.php#L1158-L1161
analogueorm/analogue
src/EntityMap.php
EntityMap.usesAttributesArray
public function usesAttributesArray(): bool { if ($this->arrayName === null) { return false; } if ($this->attributes === null) { return false; } return true; }
php
public function usesAttributesArray(): bool { if ($this->arrayName === null) { return false; } if ($this->attributes === null) { return false; } return true; }
[ "public", "function", "usesAttributesArray", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "arrayName", "===", "null", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "attributes", "===", "null", ")", "{", "return", "...
Return true if the Entity has an 'attributes' array property. @return bool
[ "Return", "true", "if", "the", "Entity", "has", "an", "attributes", "array", "property", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityMap.php#L328-L339