Skip to content

Commit 42933bf

Browse files
committed
deprecated getField method and replaced with getFieldMapping
1 parent afaf813 commit 42933bf

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,14 +1127,11 @@ public function hasField($fieldName)
11271127

11281128
/**
11291129
* {@inheritDoc}
1130+
* @deprecated use getFieldMapping instead
11301131
*/
11311132
public function getField($fieldName)
11321133
{
1133-
if (!$this->hasField($fieldName)) {
1134-
throw MappingException::fieldNotFound($this->name, $fieldName);
1135-
}
1136-
1137-
return $this->mappings[$fieldName];
1134+
return $this->getFieldMapping($fieldName);
11381135
}
11391136

11401137
/**
@@ -1290,7 +1287,7 @@ public function isInheritedField($fieldName)
12901287
*/
12911288
public function isNullable($fieldName)
12921289
{
1293-
$mapping = $this->getField($fieldName);
1290+
$mapping = $this->getFieldMapping($fieldName);
12941291
if ($mapping !== false) {
12951292
return isset($mapping['nullable']) && true == $mapping['nullable'];
12961293
}
@@ -1573,7 +1570,11 @@ public function getFieldValue($document, $field)
15731570
*/
15741571
public function getFieldMapping($fieldName)
15751572
{
1576-
return $this->getField($fieldName);
1573+
if (!$this->hasField($fieldName)) {
1574+
throw MappingException::fieldNotFound($this->name, $fieldName);
1575+
}
1576+
1577+
return $this->mappings[$fieldName];
15771578
}
15781579

15791580
/**

lib/Doctrine/ODM/PHPCR/Query/Builder/BuilderConverterPhpcr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected function getPhpcrProperty($originalAlias, $odmField)
133133
$meta = $this->aliasMetadata[$originalAlias];;
134134

135135
if ($meta->hasField($odmField)) {
136-
$fieldMeta = $meta->getField($odmField);
136+
$fieldMeta = $meta->getFieldMapping($odmField);
137137
} elseif ($meta->hasAssociation($odmField)) {
138138
$fieldMeta = $meta->getAssociation($odmField);
139139
} else {

lib/Doctrine/ODM/PHPCR/UnitOfWork.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,7 @@ private function executeInserts($documents)
24122412
*/
24132413
private function isAutocreatedProperty(ClassMetadata $class, $fieldName)
24142414
{
2415-
$field = $class->getField($fieldName);
2415+
$field = $class->getFieldMapping($fieldName);
24162416
if ('jcr:uuid' === $field['property']) {
24172417
// jackrabbit at least does not identify this as auto created
24182418
// it is strictly speaking no property

tests/Doctrine/Tests/ODM/PHPCR/Mapping/ClassMetadataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function testGetAssociationNonexisting(ClassMetadata $cm)
9999
*/
100100
public function testGetFieldNonexisting(ClassMetadata $cm)
101101
{
102-
$cm->getField('nonexisting');
102+
$cm->getFieldMapping('nonexisting');
103103
}
104104

105105
/**

tests/Doctrine/Tests/ODM/PHPCR/Query/Builder/BuilderConverterPhpcrTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function setUp()
4444
->will($me->returnValue(true));
4545

4646
$meta->expects($me->any())
47-
->method('getField')
47+
->method('getFieldMapping')
4848
->will($me->returnCallback(function ($name) {
4949

5050
$res = array(

0 commit comments

Comments
 (0)