September 2016
Intermediate to advanced
1091 pages
21h 41m
English
This recipe is the converse of the Creating an array to object hydrator recipe. In this case, we need to pull values from object properties and return an associative array where the key will be the column name.
Application\Generic\Hydrator\GetSet class defined in the previous recipe:namespace Application\Generic\Hydrator;
class GetSet
{
// code
}hydrate() method defined in the previous recipe, we define an extract() method, which takes an object as an argument. The logic is similar to that used with hydrate(), except this time we're searching for getXXX() methods. Again, preg_match() is used to match the method prefix and its suffix, which ...Read now
Unlock full access