<?php use Doctrine\ORM\Mapping AS ORM; /** * @ORM\Entity * @ORM\Table(schema="ecommerce_order", options={"charset":"utf8","collate":"utf8_unicode_ci"}) * @ORM\ChangeTrackingPolicy("DEFERRED_IMPLICIT") */ class EcommerceOrder { /** * @ORM\Id * @ORM\Column(type="integer", length=4, options={"unsigned":true}) * @ORM\GeneratedValue(strategy="SEQUENCE") */ private $id; /** * @ORM\Column(type="timestamp", nullable=true) */ private $ordered_at; /** * @ORM\Column(type="string", nullable=true) */ private $customer_note; /** * @ORM\Column(type="string", nullable=true) */ private $internal_note; /** * @ORM\OneToOne(targetEntity="Address") * @ORM\JoinColumn(name="billing_address_id", referencedColumnName="id", unique=true) */ private $BillingAddress; /** * @ORM\ManyToOne(targetEntity="Address") * @ORM\JoinColumn(name="delivery_address_id", referencedColumnName="id") */ private $DeliveryAddress; }

<?xml version="1.0"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="EcommerceOrder" change-tracking-policy="DEFERRED_IMPLICIT" schema="ecommerce_order" repository-class="Doctrine\ORM\EntityRepository"> <id name="id" type="integer" length="4"> <generator strategy="SEQUENCE"/> <options> <option name="unsigned" value="true"/> </options> </id> <field name="ordered_at" type="timestamp" nullable="true"/> <field name="customer_note" type="string" nullable="true" version="true"/> <field name="internal_note" type="string" nullable="true" version="true"/> <many-to-one field="DeliveryAddress" target-entity="Address"> <join-columns> <join-column name="delivery_address_id" referenced-column-name="id" on-delete="CASCADE"/> </join-columns> </many-to-one> <one-to-one field="BillingAddress" target-entity="Address"> <join-columns> <join-column name="billing_address_id" referenced-column-name="id" unique="true" on-delete="CASCADE"/> </join-columns> </one-to-one> <options> <option name="charset" value="utf8"/> <option name="collate" value="utf8_unicode_ci"/> </options> </entity> </doctrine-mapping>

EcommerceOrder: type: entity changeTrackingPolicy: DEFERRED_IMPLICIT schema: ecommerce_order repositoryClass: Doctrine\ORM\EntityRepository fields: id: id: true type: integer length: 4 generator: strategy: SEQUENCE options: unsigned: true ordered_at: type: timestamp nullable: true customer_note: type: string nullable: true version: true internal_note: type: string nullable: true version: true options: charset: utf8 collate: utf8_unicode_ci oneToOne: BillingAddress: targetEntity: Address joinColumns: billing_address_id: referencedColumnName: id unique: true onDelete: CASCADE manyToOne: DeliveryAddress: targetEntity: Address joinColumns: delivery_address_id: referencedColumnName: id onDelete: CASCADE