Skip to content

Commit

Permalink
Options: setFillRawValues() -> setTrackRawValues()
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed May 6, 2023
1 parent 3be4b48 commit fcde9c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/Processing/DefaultProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ private function fillObject(
$meta = $callContext->getMeta();

// Set raw data
if ($options->isFillRawValues()) {
if ($options->isTrackRawValues()) {
$this->rawValuesMap->setRawValues($object, $rawData);
}

Expand Down Expand Up @@ -657,9 +657,6 @@ private function createHolder(string $class, ClassRuntimeMeta $meta, ?MappedObje
return new ObjectHolder($this->objectCreator, $meta, $class, $object);
}

/**
* @return mixed
*/
public function getRawValues(MappedObject $object)
{
return $this->rawValuesMap->getRawValues($object);
Expand Down
16 changes: 5 additions & 11 deletions src/Processing/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class Options

private bool $prefillDefaultValues = false;

private bool $fillRawValues = false;
private bool $trackRawValues = false;

/** @var array<class-string, object> */
private array $dynamicContexts = [];
Expand Down Expand Up @@ -68,20 +68,14 @@ public function isPrefillDefaultValues(): bool
return $this->prefillDefaultValues;
}

/**
* Make user-sent values accessible by $mappedObject->getRawValues()
* Used only if objects are initialized
* Use only for debug, it may lead to significant raw data grow in bigger hierarchies
* you can set data to a custom property in before class callback, if are always needed
*/
public function setFillRawValues(bool $fill = true): void
public function setTrackRawValues(bool $fill = true): void
{
$this->fillRawValues = $fill;
$this->trackRawValues = $fill;
}

public function isFillRawValues(): bool
public function isTrackRawValues(): bool
{
return $this->fillRawValues;
return $this->trackRawValues;
}

public function addDynamicContext(object $context): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Processing/DefaultProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public function testInitialization(): void
public function testTransformation(): void
{
$options = new Options();
$options->setFillRawValues();
$options->setTrackRawValues();

$data = [
'bool' => 'true',
Expand Down Expand Up @@ -697,7 +697,7 @@ public function testPropertyCallbacksFailure(): void
public function testBeforeClassCallbackMixedValue(): void
{
$options = new Options();
$options->setFillRawValues();
$options->setTrackRawValues();

$vo = null;
$exception = null;
Expand Down

0 comments on commit fcde9c6

Please sign in to comment.