src/flowcode/ceibo/builder/QueryBuilder.php
public static function buildUpdateQuery($entity, Mapper $mapper) {
        $fields = "";
        foreach ($mapper->getPropertys() as $property) {
            if ($property->getColumn() != "id") {
                $method = "get" . $property->getName();
                $entity->$method();

                if ($property->isNumeric()) {
                    $fieldValue = "`=:" . $property->getColumn() . ", ";
                } else {
                    $fieldValue = "`=:" . $property->getColumn() . ", ";
                }
                $fields .= "`" . $property->getColumn() . $fieldValue;
            }
        }
        $fields = substr_replace($fields, "", -2);
        $query = "UPDATE `" . $mapper->getTable() . "` SET " . $fields . " WHERE id=:id";

        return $query;
    }
public static function buildUpdateQuery($entity, Mapper $mapper) {
        $fields = "";
        foreach ($mapper->getPropertys() as $property) {
            if ($property->getColumn() != "id") {
                $method = "get" . $property->getName();
                $entity->$method();

                if ($property->isNumeric()) {
                    $fieldValue = "`=:" . $property->getColumn() . ", ";
                } else {
                    $fieldValue = "`=:" . $property->getColumn() . ", ";
                }
                $fields .= "`" . $property->getColumn() . $fieldValue;
            }
        }
        $fields = substr_replace($fields, "", -2);
        $query = "UPDATE `" . $mapper->getTable() . "` SET " . $fields . " WHERE id=:id";

        return $query;
    }
public static function buildUpdateQuery ( $ entity , Mapper $ mapper ) { $ fields = "" ; foreach ( $ mapper -> getPropertys ( ) as $ property ) { if ( $ property -> getColumn ( ) != "id" ) { $ method = "get" . $ property -> getName ( ) ; $ entity -> $ method ( ) ; if ( $ property -> isNumeric ( ) ) { $ fieldValue = "`=:" . $ property -> getColumn ( ) . ", " ; } else { $ fieldValue = "`=:" . $ property -> getColumn ( ) . ", " ; } $ fields .= "`" . $ property -> getColumn ( ) . $ fieldValue ; } } $ fields = substr_replace ( $ fields , "" , - 2 ) ; $ query = "UPDATE `" . $ mapper -> getTable ( ) . "` SET " . $ fields . " WHERE id=:id" ; return $ query ; }
Return the update query for the entity.
@param type $entity
@param Mapper $mapper
@return string
Return the update query for the entity .