/** * Update an entity. * * @param object $entity The entity to insert * * @return void */ public function update($entity) { $identifier = $this->getIdentifier($entity); $data = $this->builder->reduce($entity); $this->connection->update($this->tableName, $data, $identifier); $this->builder->resolve($entity); }
/** * resolve() adds the relations to an entity */ public function testResolve() { $article = new Article(); foreach ($this->articles[1] as $key => $value) { /** @noinspection PhpVariableVariableInspection */ $article->{$key} = $value; } $this->builder->resolve($article); $this->assertObjectHasAttribute('parent', $article); /** @noinspection PhpUndefinedFieldInspection */ $this->assertNull($article->parent); $this->assertObjectHasAttribute('children', $article); /** @noinspection PhpUndefinedFieldInspection */ $this->assertInstanceOf(RepositoryInterface::class, $article->children); /** @noinspection PhpUndefinedFieldInspection */ $this->assertEquals(Article::class, $article->children->getEntityClass()); return $article; }
/** * Update an entity. * * @param object $entity The entity to insert * * @return void */ public function update($entity) { $this->gateway->update($this->tableName, $this->builder->reduce($entity), $this->getIdentifier($entity)); $this->builder->resolve($entity); }