Skip to content

Instantly share code, notes, and snippets.

@mishak87
Created September 12, 2013 22:08
Show Gist options
  • Save mishak87/6544515 to your computer and use it in GitHub Desktop.
Save mishak87/6544515 to your computer and use it in GitHub Desktop.
<?php
/** @Entity */
class Product {
/** @Column */
protected $code;
/** @OneToMany(ProductPricemap) */
protected $prices;
}
class PriceList {
/** @Column */
protected $name;
/** @Column(type="currency") */
protected $currency;
}
class ProductPrice_Map {
/** @ManyToOne(Product) */
protected $product;
/** @ManyToOne(PriceList) */
protected $priceList;
/** @Column(type="price", currencyIn="priceList"[, currencyProperty="currency"]) */
protected $amount;
}
<?php
/** @Entity */
class Product {
/** @Column */
protected $code;
/** @OneToMany(ProductPrice) */
protected $prices;
}
class ProductPrice {
/** @ManyToOne(Product) */
protected $product;
/** @Column(type="price") */
protected $price;
}
product:
- code
price_list:
- name
- currency [char(3)]
product_price_map:
- product_id (ref)
- price_list_id (ref)
- amount [decimal(10,2)]
product:
- code
product_price:
- product_id (ref)
- price_amount [decimal(10,2)]
- price_currency [char(3)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment