DDC-1811: $Placeholder bug in BasicEntityPersister #2281

Closed
opened 2026-01-22 13:47:16 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (May 6, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user rivaros:

    /****
     * Performs an UPDATE statement for an entity on a specific table.
     * The UPDATE can optionally be versioned, which requires the entity to have a version field.
     *
     * @param object $entity The entity object being updated.
     * @param string $quotedTableName The quoted name of the table to apply the UPDATE on.
     * @param array $updateData The map of columns to update (column => value).
     * @param boolean $versioned Whether the UPDATE should be versioned.
     */
    protected final function _updateTable($entity, $quotedTableName, array $updateData, $versioned = false)
    {
        $set = $params = $types = array();

        foreach ($updateData as $columnName => $value) {
            $column = $columnName;
            $placeholder = '?';

            if (isset($this->_class->fieldNames[$columnName])) {
                $column = $this->*class->getQuotedColumnName($this->_class->fieldNames[$columnName], $this->*platform);

                if (isset($this->*class->fieldMappings[$this->*class->fieldNames[$columnName]]['requireSQLConversion'])) {
                    $type = Type::getType($this->_columnTypes[$columnName]);
                    $placeholder = $type->convertToDatabaseValueSQL('?', $this->_platform); <---------------- what are you trying to convert - a questionmark? 
                }
            }

            $set[] = $column . ' = ' . $placeholder;
            $params[] = $value;
            $types[] = $this->_columnTypes[$columnName];
        }
Originally created by @doctrinebot on GitHub (May 6, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user rivaros: ``` /**** * Performs an UPDATE statement for an entity on a specific table. * The UPDATE can optionally be versioned, which requires the entity to have a version field. * * @param object $entity The entity object being updated. * @param string $quotedTableName The quoted name of the table to apply the UPDATE on. * @param array $updateData The map of columns to update (column => value). * @param boolean $versioned Whether the UPDATE should be versioned. */ protected final function _updateTable($entity, $quotedTableName, array $updateData, $versioned = false) { $set = $params = $types = array(); foreach ($updateData as $columnName => $value) { $column = $columnName; $placeholder = '?'; if (isset($this->_class->fieldNames[$columnName])) { $column = $this->*class->getQuotedColumnName($this->_class->fieldNames[$columnName], $this->*platform); if (isset($this->*class->fieldMappings[$this->*class->fieldNames[$columnName]]['requireSQLConversion'])) { $type = Type::getType($this->_columnTypes[$columnName]); $placeholder = $type->convertToDatabaseValueSQL('?', $this->_platform); <---------------- what are you trying to convert - a questionmark? } } $set[] = $column . ' = ' . $placeholder; $params[] = $value; $types[] = $this->_columnTypes[$columnName]; } ```
admin added the Bug label 2026-01-22 13:47:16 +01:00
admin closed this issue 2026-01-22 13:47:17 +01:00
Author
Owner

@doctrinebot commented on GitHub (May 27, 2012):

Comment created by @beberlei:

Its not a conversion, it is wrapped in a conversion sql function. The code is valid.

@doctrinebot commented on GitHub (May 27, 2012): Comment created by @beberlei: Its not a conversion, it is wrapped in a conversion sql function. The code is valid.
Author
Owner

@doctrinebot commented on GitHub (May 27, 2012):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (May 27, 2012): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (May 27, 2012):

Comment created by rivaros:

I will open a thread on github for someone to explain me this.

@doctrinebot commented on GitHub (May 27, 2012): Comment created by rivaros: I will open a thread on github for someone to explain me this.
Author
Owner

@doctrinebot commented on GitHub (May 27, 2012):

Comment created by rivaros:

What's the aim of this function?

    /****
     * Modifies the SQL expression (identifier, parameter) to convert to a database value.
     *
     * @param string $sqlExpr
     * @param AbstractPlatform $platform
     * @return string
     */
    public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
    {
        return $sqlExpr;
    }
@doctrinebot commented on GitHub (May 27, 2012): Comment created by rivaros: What's the aim of this function? ``` /**** * Modifies the SQL expression (identifier, parameter) to convert to a database value. * * @param string $sqlExpr * @param AbstractPlatform $platform * @return string */ public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform) { return $sqlExpr; } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2281