Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::mapOneReference PHP Method

mapOneReference() public method

Map a single document reference.
public mapOneReference ( array $mapping )
$mapping array The mapping information.
    public function mapOneReference(array $mapping)
    {
        $mapping['reference'] = true;
        $mapping['type'] = 'one';
        $this->mapField($mapping);
    }

Usage Example

Example #1
0
 public function testOwningSideAndInverseSide()
 {
     $cm = new ClassMetadataInfo('Documents\\User');
     $cm->mapManyReference(array('fieldName' => 'articles', 'inversedBy' => 'user'));
     $this->assertTrue($cm->fieldMappings['articles']['isOwningSide']);
     $cm = new ClassMetadataInfo('Documents\\Article');
     $cm->mapOneReference(array('fieldName' => 'user', 'mappedBy' => 'articles'));
     $this->assertTrue($cm->fieldMappings['user']['isInverseSide']);
 }
All Usage Examples Of Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::mapOneReference
ClassMetadataInfo