Prado\Data\SqlMap\Statements\TMappedStatement::setObjectProperty PHP Method

setObjectProperty() protected method

Set a property of the result object with appropriate value.
protected setObjectProperty ( $resultMap, $property, $row, &$resultObject )
    protected function setObjectProperty($resultMap, $property, $row, &$resultObject)
    {
        $select = $property->getSelect();
        $key = $property->getProperty();
        $nested = $property->getNestedResultMap();
        $registry = $this->getManager()->getTypeHandlers();
        if ($key === '') {
            $resultObject = $property->getPropertyValue($registry, $row);
        } else {
            if (strlen($select) == 0 && $nested === null) {
                $value = $property->getPropertyValue($registry, $row);
                $this->_IsRowDataFound = $this->_IsRowDataFound || $value != null;
                if (is_array($resultObject) || is_object($resultObject)) {
                    TPropertyAccess::set($resultObject, $key, $value);
                } else {
                    $resultObject = $value;
                }
            } else {
                if ($nested !== null) {
                    if ($property->instanceOfListType($resultObject) || $property->instanceOfArrayType($resultObject)) {
                        if (strlen($resultMap->getGroupBy()) <= 0) {
                            throw new TSqlMapExecutionException('sqlmap_non_groupby_array_list_type', $resultMap->getID(), get_class($resultObject), $key);
                        }
                    } else {
                        $obj = $nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
                        if ($this->fillPropertyWithResultMap($nested, $row, $obj) == false) {
                            $obj = null;
                        }
                        TPropertyAccess::set($resultObject, $key, $obj);
                    }
                } else {
                    $this->enquequePostSelect($select, $resultMap, $property, $row, $resultObject);
                }
            }
        }
    }