# Cross Object Mapper References behavior extension for Doctrine 2 Create documents and entities that contain references to each other. ## Options The following options are possible on reference one and many associations: **Owning Side** - **type** - The type of association. - **class** - The associated class name. - **inversedBy** - The property name for the inverse side of this association. - **identifier** - The property name to store the associated object id in. **Inverse Side** - **type** - The type of association. - **class** - The associated class name. - **mappedBy** - The property name for the owning side of this association. ## Annotations **@Gedmo\ReferenceOne** ``` php id; } public function setId($id) { $this->id = $id; } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; } public function getStockItems() { return $this->stockItems; } public function setStockItems(Collection $stockItems) { $this->stockItems = $stockItems; } } ``` The `StockItem` has a reference to the `Product` as well. ``` php id; } public function setId($id) { $this->id = $id; } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; } public function getSku() { return $this->sku; } public function setSku($sku) { $this->sku = $sku; } public function getQuantity() { return $this->quantity; } public function setQuantity($quantity) { $this->quantity = $quantity; } public function setProduct(Product $product) { $this->product = $product; } public function getProduct() { return $this->product; } public function setProductId($productId) { $this->productId = $productId; } public function getProductId() { return $this->productId; } } ```