Skip to content

Incorrect documentation example for QueryBuilder#set() #2814

Closed
@Dormilich

Description

@Dormilich

The affected code section (also the update() and where() examples)

     * <code>
     *     $qb = $conn->createQueryBuilder()
     *         ->update('users', 'u')
     *         ->set('u.password', md5('password'))
     *         ->where('u.id = ?');
     * </code>

When looking at the source code for set(), the $value parameter is not escaped (which makes sense) but then any unescaped string value (such as the mentioned MD5 hash) would cause an SQL syntax error due to missing string delimiters. Insofar the code example is misleading as to what can be put in as value.

Maybe a better example would be using one of the SQL functions, e.g.

->set('u.last_login', 'NOW()')

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions