Doctrine 1
  1. Doctrine 1
  2. DC-989

Doctrine_Connection::execute() and Doctrine_Connection::exec() fail if Doctrine_Event::skipOperation() is triggered

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: Connection
    • Labels:
      None

      Description

      In order to generate SQL from migrations, an event listener was attached to the migration system to monitor for preQuery and preExec events.

      In an attempt to prevent the migration from additionally writing the query to the database, the skipOperation method was triggered, and supposedly allowed for n the execute() and exec() methods of Doctrine_Connection

      eg. Doctrine_Connection::execute()
       
      $this->getAttribute(Doctrine_Core::ATTR_LISTENER)->preQuery($event);
      
      if ( ! $event->skipOperation) {
          $stmt = $this->dbh->query($query);
          $this->_count++;
      }
      $this->getAttribute(Doctrine_Core::ATTR_LISTENER)->postQuery($event);
      

      unfortunately setting this option in the event listener breaks execution of the migration system as the $count/$stmtn variables (used in the methods) are no longer defined, triggering E_NOTICE, and the fetch* methods (eg fetchColumn) also break as they are chaining methods without testing for the return. theerfore, even if the $stmnt variable was created as initially null, the system would still throw an E_FATAL as the NULL variable doest provide the ::fetchColumn() methods (etc).

      Quite a serious flaw as 2 areas of code do not provide a consistent approach to how to work with events.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            David Dixon
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: