I am retrieving an Category
entity through the DAL and change some values.
$randomId = 'an-existing-category-id';
$result = $this->categoryRepository->search((new Criteria())->addFilter(new EqualsAnyFilter('id', $ids)), Context::createDefaultContext());
$entity = $result->get($randomId);
$entity->setParentId('new-parent-id');
Instead of converting the entity to array and passing it to the DAL to upsert
it i wonder if it is possible to "persist" the complete entity like in doctrine?
It is not possible, you can update a record using only update
or upsert
method of the entity repository.
But you don't need to convert the whole entity to an array, you just need to provide id
and fields that should be updated (not all fields).