Get indices
public getIndices ( ) : Bravo3\Orm\Mappers\Metadata\Index[] | ||
리턴 | Bravo3\Orm\Mappers\Metadata\Index[] |
/** * Compile normal indices * * @param Entity $md * @return array */ private function compileStdIndices(Entity $md) { $out = []; $indices = $md->getIndices(); foreach ($indices as $index) { $data = []; if ($index->getColumns()) { $data[Schema::INDEX_COLUMNS] = $index->getColumns(); } if ($index->getMethods()) { $data[Schema::INDEX_METHODS] = $index->getMethods(); } $out[$index->getName()] = $data; } return $out; }
/** * Deserialise and hydrate all primitive data in the proxy (not relationships) * * @return $this */ public function hydrate() { $serialiser = $this->entity_manager->getSerialiserMap()->getSerialiser($this->serialised_data->getSerialisationCode()); /** @var OrmProxyInterface $proxy */ $proxy = $this->getProxy(); // Deserialise and hydrate the entity $serialiser->deserialise($this->metadata, $this->serialised_data, $proxy); // Save the original state of all indices so we can compare on consequent persist calls $proxy->setOriginalId($this->getReader()->getId()); foreach ($this->metadata->getIndices() as $index) { // If an index is a relationship, automatic hydration will not work due to AOP recursion // Instead, check each index column for a relationship and hydrate it manually foreach ($index->getColumns() as $column) { if ($relationship = $this->metadata->getRelationshipByName($column)) { if (!isset($this->hydrated_methods[$relationship->getGetter()])) { $this->hydrateRelative($relationship); } } } $proxy->setIndexOriginalValue($index->getName(), $this->getReader()->getIndexValue($index)); } $this->is_hydrated = true; return $this; }