/** * Determine Mapper (early stage [draft] support for cross-entity upserts) * * @param Entity $obj_gds_entity * @return Mapper */ protected function determineMapper(Entity $obj_gds_entity) { $str_this_kind = $obj_gds_entity->getKind(); if (!isset($this->arr_kind_mappers[$str_this_kind])) { $this->arr_kind_mappers[$str_this_kind] = $this->createMapper(); if ($this->obj_schema->getKind() != $str_this_kind) { $this->arr_kind_mappers[$str_this_kind]->setSchema($obj_gds_entity->getSchema()); } } return $this->arr_kind_mappers[$str_this_kind]; }
/** * Set the Schema for the Entity * * @param Schema $obj_schema * @return $this */ public function setSchema(Schema $obj_schema) { $this->obj_schema = $obj_schema; $this->setKind($obj_schema->getKind()); return $this; }
/** * Fetch all of the entities in a particular group * * @param Entity $obj_entity * @return Entity[] */ public function fetchEntityGroup(Entity $obj_entity) { $arr_results = $this->obj_gateway->withSchema($this->obj_schema)->withTransaction($this->str_transaction_id)->gql("SELECT * FROM `" . $this->obj_schema->getKind() . "` WHERE __key__ HAS ANCESTOR @ancestorKey", ['ancestorKey' => $obj_entity]); $this->str_last_cursor = $this->obj_gateway->getEndCursor(); return $arr_results; }