Phalcon models cloneResult() and cloneResultMaps() please elaborate?

Hi, Im new in phalcon and have a good knowlegde when it comes to OOP, though there are some things I would like to understand more on the process cloneResult() and cloneResultMaps() on how it will affect this on my Model? and what are the other parameters such as:

  1. keepSnapshot -> what snapshot it will take and how it will help me for future reference.
  2. dryState -> what does this mean?

I want to know more on using the Getters and Setters for models. Thank you for your reply.



Can anyone please explain how cloneResult() and cloneResultMaps() work and what they're for?



It appears to do something similar to the following with some additional features. Just search for cloneResultMap in the cphalcon github repo and look at the Model.zep file. Its real easy to read the source code now that it is in Zephir.

$copied = new Umbrella();
$data = $original->toArray();


I have a complex hierarchical system where records are upgraded during the create hooks to be a more specific type and I use cloneResultMap to get the new record up to speed. Everything can be done with individual method calls so if you understand the rest of the API then you aren't missing anything.

$record = self::cloneResultMap(self::factory($this->type), $this->toArray(), self::DIRTY_STATE_PERSISTENT, true);