Skip to content

fix bug in Symfony\Bundle\DoctrineMigrationsBundle\Command\DoctrineCommand #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

stfalcon
Copy link
Contributor

Command "php app/console doctrine:migrations:status --bundle="PortfolioBundle"" don't working after last sandbox update:

PHP Fatal error: Using $this when not in object context in /var/www/test/symfony2/src/vendor/symfony/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php on line 30

After this fix "doctrine:migrations:*" commands work fine

dawehner pushed a commit to dawehner/symfony that referenced this pull request Jul 1, 2013
unset _locale parameter if matching route has been found
SofHad pushed a commit to SofHad/symfony that referenced this pull request Oct 12, 2015
This PR was merged into the master branch.

Discussion
----------

fix a typo

Commits
-------

c722b13 fix a typo
fabpot added a commit that referenced this pull request Jan 25, 2016
…e arguments in collection arguments (ogizanagi)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[DependencyInjection] Properly ignore invalid reference arguments in collection arguments

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

With this new feature, the following configuration:

```xml
<service id="baz" class="Baz"/>

<service id="foo" class="Foo">
    <argument type="collection">
        <argument type="service" id="bar" on-invalid="ignore" />
        <argument type="service" id="baz" />
        <argument type="service" id="moo" on-invalid="null" />
    </argument>

    <argument type="service" id="bar" on-invalid="ignore" />
    <argument type="service" id="baz" />
    <argument type="service" id="moo" on-invalid="null" />

    <call method="foo">
        <argument type="service" id="bar" on-invalid="ignore" />
    </call>
    <call method="fooCollection">
        <argument type="collection">
            <argument type="service" id="bar" on-invalid="ignore" />
            <argument type="service" id="baz" />
            <argument type="service" id="moo" on-invalid="null" />
        </argument>
    </call>
</service>
```

will result into the following `Definition`:

```php
Definition {#64 ▼
  -class: "Foo"
  // […]
  -calls: array:1 [▼
    0 => array:2 [▼
      0 => "fooCollection"
      1 => array:1 [▼
        0 => array:2 [▼
          0 => Reference {#59 ▼
            -id: "baz"
            -invalidBehavior: 1
          }
          1 => null
        ]
      ]
    ]
  ]
  // […]
  #arguments: array:4 [▼
    0 => array:2 [▼
      0 => Reference {#63 ▼
        -id: "baz"
        -invalidBehavior: 1
      }
      1 => null
    ]
    1 => null
    2 => Reference {#56 ▼
      -id: "baz"
      -invalidBehavior: 1
    }
    3 => null
  ]
}
```

Invalid references are ignored instead of replaced by `null` when they are part of a collection argument.
If the collection argument is part of a method call and contains an invalid reference, the method call is kept, but the invalid reference removed.

The behavior stays the same as before for non-collection arguments.

:christmas_tree:

Commits
-------

cfc4879 [DependencyInjection] Properly ignore invalid reference arguments in collection arguments
jderusse pushed a commit to jderusse/symfony that referenced this pull request Mar 30, 2020
jderusse pushed a commit to jderusse/symfony that referenced this pull request Dec 15, 2020
…riting operations (Briones)

This PR was merged into the 3.0-dev branch.

Discussion
----------

fix: change executeQuery method to executeUpdate for writing operations

I noticed in a project that uses this library that this is using `executeQuery` doctrine method for writing operations, for systems that has a `master` and `slave` databases it results in errors since the slave normally is configured to be read-only and using  `executeQuery` leads to Doctrine trying to use the slave read-only instance to insert, delete or update data, causing errors like the following in Mysql:

```
Error Code: 1290. The MySQL server is running with the –read-only option so it cannot execute this statement
```

This PR changes the `executeQuery` for `executeUpdate` for the writing cases.

Commits
-------

8e5d155 fix: change executeQuery method to executeUpdate for writing operations
stobrien89 pushed a commit to stobrien89/symfony that referenced this pull request Feb 27, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant