Skip to content

Conversation

@nykopol
Copy link
Contributor

@nykopol nykopol commented May 9, 2016

Q A
Branch? 2.7
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #18694
License MIT
Doc PR

When you try do define a manyToMany association but you don't give an array or \Traversable, the raised exception say that some methods are missing while they don't. This PR check if the adder and setter methods exists and if so, give a exception that pointing on the real problem.

@xabbuh
Copy link
Member

xabbuh commented May 9, 2016

@nykopol Can you please also add a test to prevent future regressions?

@nykopol
Copy link
Contributor Author

nykopol commented May 10, 2016

@xabbuh I added the test.

@javiereguiluz javiereguiluz added Feature DX DX = Developer eXperience (anything that improves the experience of using Symfony) labels May 10, 2016
'"%s" given.',
$property,
$reflClass->name,
implode(' and ', array_map(function($method){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is offending PSR-2 - 6.Closures.

// we call the getter and hope the __call do the job
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_MAGIC;
$access[self::ACCESS_NAME] = $setter;
} elseif (null !== $this->findAdderAndRemover($reflClass, $singulars)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null !== $methods = ...

@fabpot
Copy link
Member

fabpot commented Jun 15, 2016

Thank you @nykopol.

fabpot added a commit that referenced this pull request Jun 15, 2016
…methods are missing if they don't (nykopol)

This PR was squashed before being merged into the 2.7 branch (closes #18732).

Discussion
----------

[PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't

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

When you try do define a manyToMany association but you don't give an array or \Traversable, the raised exception say that some methods are missing while they don't. This PR check if the adder and setter methods exists and if so, give a exception that pointing on the real problem.

Commits
-------

c46519b [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't
@fabpot fabpot closed this Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX DX = Developer eXperience (anything that improves the experience of using Symfony) Feature PropertyAccess Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants