Question

I am trying to update table using DQL query on database used in open source project Authpuppy which uses doctrine 1.2 and symfony 1.4,

I am trying to execute following Doctrine Update Query,

$q = Doctrine_Query::create()
    ->update('Connection')
    ->set('status', 'LOGGED_OUT')
    ->where('token = ?', $fields['token']);

    $q->execute();

It Gives Error:

Doctrine_Connection_Mysql_Exception

Following is the Schema.yml,

Connection:
  tableName: connections
  actAs: [Timestampable]
  columns:
    node_id:
      type: integer
      notnull: true
    token: 
      type: string(255)
      unique: true
      notnull: true
    status:
      type: string(255)
      notnull: true
    mac:
      type: string(255)
    ip:
      type: string(255)
    auth_type:
      type: string(255)
    identity:
      type: string(255)
    incoming:
      type: float
      default: 0
    outgoing:
      type: float
      default: 0
  relations:
    Node:
      class: Node
      local: node_id
      foreign: id
      type: one
      onDelete: CASCADE
  options:
    symfony:
      form: false
      filter: false 
      model: false
Was it helpful?

Solution

I solved this question. Thanks to Marc B

$q = Doctrine_Query::create()
    ->update('Connection')
    ->set('status', '?', 'LOGGED_OUT')   //Here is the change
    ->where('token = ?', $fields['token']);

    $q->execute();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top