Skip to content

Commit a1e6e92

Browse files
committed
converted tabs to spaces
1 parent 880bafb commit a1e6e92

File tree

10 files changed

+283
-283
lines changed

10 files changed

+283
-283
lines changed

lib/Doctrine/ODM/MongoDB/DocumentRepository.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ public function clear()
9292
public function find($query = array(), array $select = array())
9393
{
9494
if (is_string($query)) {
95-
if ($document = $this->_dm->getUnitOfWork()->tryGetById($query, $this->_documentName)) {
96-
return $document; // Hit!
97-
}
95+
if ($document = $this->_dm->getUnitOfWork()->tryGetById($query, $this->_documentName)) {
96+
return $document; // Hit!
97+
}
9898

99-
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->loadById($query);
99+
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->loadById($query);
100100
} else {
101-
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->loadAll($query, $select);
101+
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->loadAll($query, $select);
102102
}
103103
}
104104

@@ -112,7 +112,7 @@ public function find($query = array(), array $select = array())
112112
*/
113113
public function findOne(array $query = array(), array $select = array())
114114
{
115-
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->load($query, $select);
115+
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->load($query, $select);
116116
}
117117

118118
/**

lib/Doctrine/ODM/MongoDB/Mapping/Driver/DoctrineAnnotations.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ final class ReferenceMany extends Annotation
144144
public $reference = true;
145145
public $targetDocument;
146146
public $cascade;
147-
public $strategy = 'set';
147+
public $strategy = 'set';
148148
}
149149

150150
/* Annotations for lifecycle callbacks */

lib/Doctrine/ODM/MongoDB/Mapping/Driver/YamlDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private function _getMappingFromReference($fieldName, $reference, $type)
143143
'reference' => true,
144144
'targetDocument' => $reference['targetDocument'],
145145
'name' => $fieldName,
146-
'strategy' => (isset ($reference['strategy'])) ? $reference['strategy'] : 'set',
146+
'strategy' => (isset ($reference['strategy'])) ? $reference['strategy'] : 'set',
147147
);
148148
return $mapping;
149149
}

lib/Doctrine/ODM/MongoDB/PersistentCollection.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
final class PersistentCollection implements Collection
3636
{
3737

38-
protected $_owner;
38+
protected $_owner;
3939

40-
protected $_mapping;
40+
protected $_mapping;
4141

4242
/**
4343
* The DocumentManager that manages the persistence of the collection.
@@ -165,15 +165,15 @@ public function getOwner()
165165
return $this->_owner;
166166
}
167167

168-
public function getMapping()
169-
{
170-
return $this->_mapping;
171-
}
168+
public function getMapping()
169+
{
170+
return $this->_mapping;
171+
}
172172

173-
public function getTypeClass()
174-
{
175-
return $this->_typeClass;
176-
}
173+
public function getTypeClass()
174+
{
175+
return $this->_typeClass;
176+
}
177177

178178
/**
179179
* Sets the initialized flag of the collection, forcing it into that state.

lib/Doctrine/ODM/MongoDB/Persisters/AbstractCollectionPersister.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ abstract class AbstractCollectionPersister
2020
*/
2121
protected $_uow;
2222

23-
protected $_documentPersister;
23+
protected $_documentPersister;
2424

25-
public function __construct(DocumentManager $dm, $documentPersister)
26-
{
27-
$this->_dm = $dm;
28-
$this->_uow = $dm->getUnitOfWork();
29-
$this->_documentPersister = $documentPersister;
30-
}
25+
public function __construct(DocumentManager $dm, $documentPersister)
26+
{
27+
$this->_dm = $dm;
28+
$this->_uow = $dm->getUnitOfWork();
29+
$this->_documentPersister = $documentPersister;
30+
}
3131

3232
/**
3333
* Deletes the persistent state represented by the given collection.
@@ -36,8 +36,8 @@ public function __construct(DocumentManager $dm, $documentPersister)
3636
*/
3737
public function delete(PersistentCollection $coll)
3838
{
39-
$class = $coll->getTypeClass();
40-
$collection = $this->_dm->getDocumentCollection($class->name);
39+
$class = $coll->getTypeClass();
40+
$collection = $this->_dm->getDocumentCollection($class->name);
4141
}
4242

4343
/**
@@ -47,22 +47,22 @@ public function delete(PersistentCollection $coll)
4747
* @param PersistentCollection $coll
4848
*/
4949
public function update(PersistentCollection $coll)
50-
{
51-
$this->deleteDocs($coll);
52-
$this->insertDocs($coll);
53-
}
50+
{
51+
$this->deleteDocs($coll);
52+
$this->insertDocs($coll);
53+
}
5454

55-
public function deleteDocs(PersistentCollection $coll)
55+
public function deleteDocs(PersistentCollection $coll)
5656
{
57-
foreach ($coll as $doc) {
58-
$this->_documentPersister->delete($doc);
59-
}
57+
foreach ($coll as $doc) {
58+
$this->_documentPersister->delete($doc);
59+
}
6060
}
6161

6262
public function insertDocs(PersistentCollection $coll)
6363
{
64-
foreach ($coll as $doc) {
65-
$this->_documentPersister->addInsert($doc);
66-
}
64+
foreach ($coll as $doc) {
65+
$this->_documentPersister->addInsert($doc);
66+
}
6767
}
6868
}

lib/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php

+74-74
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,86 @@
33
namespace Doctrine\ODM\MongoDB\Persisters;
44

55
use Doctrine\ODM\MongoDB\DocumentManager,
6-
Doctrine\ODM\MongoDB\Mapping\ClassMetadata,
7-
Doctrine\ODM\MongoDB\MongoCursor,
8-
Doctrine\ODM\MongoDB\Mapping\Types\Type,
9-
Doctrine\Common\Collections\Collection;
6+
Doctrine\ODM\MongoDB\Mapping\ClassMetadata,
7+
Doctrine\ODM\MongoDB\MongoCursor,
8+
Doctrine\ODM\MongoDB\Mapping\Types\Type,
9+
Doctrine\Common\Collections\Collection;
1010

1111
/**
1212
* @author Bulat Shakirzyanov <bulat@theopenskyproject.com>
1313
*/
1414
class BasicDocumentPersister
1515
{
16-
protected $_dm;
17-
protected $_uow;
18-
protected $_class;
19-
protected $_collection;
20-
protected $_documentName;
21-
protected $_documentIdentifiers = array();
22-
protected $_queuedInserts = array();
23-
public function __construct(DocumentManager $dm, ClassMetadata $class)
24-
{
25-
$this->_dm = $dm;
26-
$this->_uow = $dm->getUnitOfWork();
27-
$this->_class = $class;
28-
$this->_documentName = $class->getName();
16+
protected $_dm;
17+
protected $_uow;
18+
protected $_class;
19+
protected $_collection;
20+
protected $_documentName;
21+
protected $_documentIdentifiers = array();
22+
protected $_queuedInserts = array();
23+
public function __construct(DocumentManager $dm, ClassMetadata $class)
24+
{
25+
$this->_dm = $dm;
26+
$this->_uow = $dm->getUnitOfWork();
27+
$this->_class = $class;
28+
$this->_documentName = $class->getName();
2929
$this->_collection = $dm->getDocumentCollection($class->name);
30-
}
30+
}
3131
public function addInsert($document)
32-
{
32+
{
3333
$this->_queuedInserts[spl_object_hash($document)] = $document;
34-
}
34+
}
3535
public function executeInserts()
36-
{
36+
{
3737
if ( ! $this->_queuedInserts) {
3838
return;
3939
}
4040

4141
$postInsertIds = array();
42-
$inserts = array();
42+
$inserts = array();
4343

4444
foreach ($this->_queuedInserts as $oid => $document) {
45-
$data = $this->_prepareInsertData($document);
45+
$data = $this->_prepareInsertData($document);
4646
$inserts[$oid] = $data;
47-
}
48-
$this->_collection->batchInsert($inserts);
49-
50-
foreach ($inserts as $oid => $data) {
51-
$document = $this->_queuedInserts[$oid];
52-
$postInsertIds[(string) $data['_id']] = $document;
53-
if ($this->_class->isFile()) {
54-
$this->_dm->getHydrator()->hydrate($this->_class, $document, $data);
55-
}
56-
}
57-
58-
return $postInsertIds;
59-
}
47+
}
48+
$this->_collection->batchInsert($inserts);
49+
50+
foreach ($inserts as $oid => $data) {
51+
$document = $this->_queuedInserts[$oid];
52+
$postInsertIds[(string) $data['_id']] = $document;
53+
if ($this->_class->isFile()) {
54+
$this->_dm->getHydrator()->hydrate($this->_class, $document, $data);
55+
}
56+
}
57+
58+
return $postInsertIds;
59+
}
6060
public function update($document)
61-
{
62-
$update = $this->_prepareUpdateData($document);
63-
$id = $update['_id'];
64-
unset($update['_id']);
61+
{
62+
$update = $this->_prepareUpdateData($document);
63+
$id = $update['_id'];
64+
unset($update['_id']);
6565

66-
$this->_collection->update(array('_id' => $id), array('$set' => $update));
67-
}
66+
$this->_collection->update(array('_id' => $id), array('$set' => $update));
67+
}
6868
public function delete($document)
69-
{
69+
{
7070
$id = $this->_uow->getDocumentIdentifier($document);
71-
$this->_collection->remove(array('_id' => new \MongoId($id)));
72-
}
73-
74-
private function _prepareInsertData($document)
75-
{
76-
return $this->_prepareUpdateData($document);
77-
}
78-
private function _prepareUpdateData($document)
79-
{
71+
$this->_collection->remove(array('_id' => new \MongoId($id)));
72+
}
73+
74+
private function _prepareInsertData($document)
75+
{
76+
return $this->_prepareUpdateData($document);
77+
}
78+
private function _prepareUpdateData($document)
79+
{
8080
$oid = spl_object_hash($document);
8181
$changeset = $this->_uow->getDocumentChangeSet($document);
8282
foreach ($changeset as $fieldName => $values) {
8383
$changeset[$fieldName] = $values[1];
8484
}
85-
$docId = $this->_uow->getDocumentIdentifier($document);
85+
$docId = $this->_uow->getDocumentIdentifier($document);
8686
if ($docId) {
8787
$changeset['_id'] = new \MongoId($docId);
8888
}
@@ -116,7 +116,7 @@ private function _prepareUpdateData($document)
116116
}
117117
}
118118
return $changeset;
119-
}
119+
}
120120

121121
/**
122122
* Gets the ClassMetadata instance of the entity class this persister is used for.
@@ -128,9 +128,9 @@ public function getClassMetadata()
128128
return $this->_class;
129129
}
130130
public function refresh(array $id, $document)
131-
{
132-
133-
}
131+
{
132+
133+
}
134134

135135
/**
136136
* Loads an entity by a list of field criteria.
@@ -153,13 +153,13 @@ public function load(array $query = array(), array $select = array())
153153
}
154154

155155
public function loadById($id)
156-
{
157-
$result = $this->_collection->findOne(array('_id' => new \MongoId($id)));
158-
if ($result !== null) {
159-
return $this->_uow->getOrCreateDocument($this->_documentName, $result);
160-
}
161-
return null;
162-
}
156+
{
157+
$result = $this->_collection->findOne(array('_id' => new \MongoId($id)));
158+
if ($result !== null) {
159+
return $this->_uow->getOrCreateDocument($this->_documentName, $result);
160+
}
161+
return null;
162+
}
163163

164164
/**
165165
* Loads a list of entities by a list of field criteria.
@@ -168,10 +168,10 @@ public function loadById($id)
168168
* @return array
169169
*/
170170
public function loadAll(array $query = array(), array $select = array())
171-
{
172-
$cursor = $this->_collection->find($query, $select);
173-
return new MongoCursor($this->_dm, $this->_dm->getHydrator(), $this->_class, $cursor);
174-
}
171+
{
172+
$cursor = $this->_collection->find($query, $select);
173+
return new MongoCursor($this->_dm, $this->_dm->getHydrator(), $this->_class, $cursor);
174+
}
175175

176176
/**
177177
* returns the reference representation to be stored in mongodb
@@ -183,12 +183,12 @@ public function loadAll(array $query = array(), array $select = array())
183183
private function _prepareDocReference($class, $doc)
184184
{
185185
$id = $this->_uow->getDocumentIdentifier($doc);
186-
$ref = array(
187-
'$ref' => $class->getCollection(),
188-
'$id' => $id,
189-
'$db' => $class->getDB()
190-
);
191-
return $ref;
186+
$ref = array(
187+
'$ref' => $class->getCollection(),
188+
'$id' => $id,
189+
'$db' => $class->getDB()
190+
);
191+
return $ref;
192192
}
193193

194194
/**

0 commit comments

Comments
 (0)