doctrine:cache:clear-* and doctrine:mongodb:cache:clear-* have inconsistent behaviors #6110

Closed
opened 2026-01-22 15:26:53 +01:00 by admin · 0 comments
Owner

Originally created by @edhelas on GitHub (Nov 26, 2018).

Bug Report

doctrine/mongodb-odm 1.2.5
doctrine/orm v2.6.2

Summary

When calling the following doctrine commands

  • doctrine:cache:clear-metadata
  • doctrine:cache:clear-query
  • doctrine:cache:clear-result

I'm expecting the same behavior as

  • doctrine:mongodb:cache:clear-metadata

Current behavior

Those commands are actually failing if no cache was cleared

if ( ! $result) {
  $ui->error($message);

  return 1;
}

How to reproduce

Call those commands with an empty cache

Expected behavior

The behavior from MongoDB seems more natural. Those commands shoudn't return an error if no cache was cleared but simply display an information message.
When wrapping those commands in composer there is no proper way to make them fail silently

"cache:doctrine": [
    "bin/console doctrine:mongodb:cache:clear-metadata --ansi",
    "bin/console doctrine:cache:clear-metadata --ansi",
    // Fail there 
    "bin/console doctrine:cache:clear-query --ansi",
    "bin/console doctrine:cache:clear-result --ansi"
],
Originally created by @edhelas on GitHub (Nov 26, 2018). ### Bug Report doctrine/mongodb-odm 1.2.5 doctrine/orm v2.6.2 #### Summary When calling the following doctrine commands * `doctrine:cache:clear-metadata` * `doctrine:cache:clear-query` * `doctrine:cache:clear-result` I'm expecting the same behavior as * `doctrine:mongodb:cache:clear-metadata` #### Current behavior Those commands are actually failing if no cache was cleared ```php if ( ! $result) { $ui->error($message); return 1; } ``` #### How to reproduce Call those commands with an empty cache #### Expected behavior The behavior from MongoDB seems more natural. Those commands shoudn't return an error if no cache was cleared but simply display an information message. When wrapping those commands in composer there is no proper way to make them fail silently ```json "cache:doctrine": [ "bin/console doctrine:mongodb:cache:clear-metadata --ansi", "bin/console doctrine:cache:clear-metadata --ansi", // Fail there "bin/console doctrine:cache:clear-query --ansi", "bin/console doctrine:cache:clear-result --ansi" ], ```
admin added the Bug label 2026-01-22 15:26:53 +01:00
admin closed this issue 2026-01-22 15:26:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6110