Doctrine 1
  1. Doctrine 1
  2. DC-355

Call to a member function evictAll() if a table is retrieved, that is not existent

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0, 1.2.1
    • Fix Version/s: None
    • Component/s: Connection
    • Labels:
      None
    • Environment:
      Ubuntu 8.04

      Description

      Hi!

      Im not quite sure it this bahaviour is wanted, but i think that this
      should be catched:

      If i call Doctrine::getTable on a non existing model, the exception is
      thrown. After them i want always to clear all Record Repositories, see
      code:

      try

      { $table = Doctrine::getTable('notexistent'); }

      catch(Exception $e)

      { echo 'not existent'.$e->getMessage(); }

      Doctrine_Manager::connection()->clear();

      Then I get the error message:

      Fatal error: Call to a member function evictAll() on a non-object in /
      core/lib/Doctrine/Doctrine/Connection.php on line 1239

      The problem is that the function clear doesnt check if a repository is
      given.

      public function clear()
      {
      foreach ($this->tables as $k => $table)

      { $table->getRepository()->evictAll(); // getRepository delivers FALSE $table->clear(); }

      }

      Is it normal behaviour? Or should it be checked first:

      if ($repository = $table->getRepository())

      { $repository->evisctAll(); }

      best regards,
      aNj

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated: