10000 [PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist by karser · Pull Request #28962 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist #28962

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
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[PropertyAccessor] isWritable is not a guard but helps to reproduce t…
…he issue
  • Loading branch information
karser committed Oct 23, 2018
commit 91983f7d4adadad36b4e692cbca77807b84f2a4e
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,8 @@ public function testWriteToSingularPropertyWhilePluralOneExists()
{
$object = new TestSingularAndPluralProps();

if ($this->propertyAccessor->isWritable($object, 'email')) {
$this->propertyAccessor->setValue($object, 'email', 'test@email.com');
}
$this->propertyAccessor->isWritable($object, 'email'); //cache access info
$this->propertyAccessor->setValue($object, 'email', 'test@email.com');

self::assertEquals('test@email.com', $object->getEmail());
self::assertEmpty($object->getEmails());
Expand All @@ -693,9 +692,8 @@ public function testWriteToPluralPropertyWhileSingularOneExists()
{
$object = new TestSingularAndPluralProps();

if ($this->propertyAccessor->isWritable($object, 'emails')) {
$this->propertyAccessor->setValue($object, 'emails', array('test@email.com'));
}
$this->propertyAccessor->isWritable($object, 'emails'); //cache access info
$this->propertyAccessor->setValue($object, 'emails', array('test@email.com'));

self::assertEquals(array('test@email.com'), $object->getEmails());
self::assertNull($object->getEmail());
Expand Down
0