Permalink
Browse files

Merge pull request #792

  • Loading branch information...
2 parents dec2bda + 13338b2 commit 85f6898395cbf5e1e831eb371b536572a4061cc6 @jmikola jmikola committed Feb 4, 2014
View
2 lib/Doctrine/ODM/MongoDB/Event/PreLoadEventArgs.php
@@ -43,7 +43,7 @@ class PreLoadEventArgs extends LifecycleEventArgs
public function __construct($document, DocumentManager $dm, array &$data)
{
parent::__construct($document, $dm);
- $this->data = $data;
+ $this->data =& $data;
}
/**
View
24 tests/Doctrine/ODM/MongoDB/Tests/Events/PreLoadEventArgsTest.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Doctrine\ODM\MongoDB\Tests\Events;
+
+use Doctrine\ODM\MongoDB\Event\PreLoadEventArgs;
+use Documents\Group;
+
+class PreLoadEventArgsTest extends \Doctrine\ODM\MongoDB\Tests\BaseTest
+{
+ public function testGetData()
+ {
+ $document = new Group('test');
+ $dm = $this->dm;
+ $data = array('id' => '1234', 'name' => 'test');
+
+ $eventArgs = new PreLoadEventArgs($document, $dm, $data);
+
+ $this->assertEquals('test', $eventArgs->getData()['name']);
+
+ $eventArgs->getData()['name'] = 'alt name';
+
+ $this->assertEquals('alt name', $data['name']);
+ }
+}

0 comments on commit 85f6898

Please sign in to comment.