Hi
I have been strugling with a problem for quite some time.
I have a model like this (see below).
I usually make a list where i get stocks from a certain broker.
But now i would like to make a list with one stock only (the same
stock_id (stock_id = 13)) and then the price values for each broker.
This will allow me to see the same stock all the way down the list,
but different broker properties and different prices (note that each
broker has its own price pr. stock).
Normal output (the way i use it now)
Array(
-->Stock (id:1)
---->Prices
---->Quotes,
-->Stock (id:2)
---->Prices
---->Quotes
)
Requested output (the i want it also to be - normal output should not
break)
Array(
Broker (id:SFD)(
-->Stock (id:2)
---->Prices
---->Quotes
),
Broker (id:SRE)(
-->Stock (id:2)
---->Prices
---->Quotes
),
Broker (id:SRE)(
-->Stock (id:2)
---->Prices
---->Quotes
)
)
I was recently considering building my requested model myself, but i
assume that doctrine easily could do the job for me.
If my question is unclear in any way, please let me know and let my
try to explain further.
Thanks!
YAML:
Broker:
tableName: broker
columns:
id:
type: string(20)
primary: true
name: string(255)
prices_updated: timestamp
relations:
Stocks:
class: Stock
local: id
foreign: stock_id
type: many
Prices:
class: Price
local: id
foreign: broker_id
type: many
indexes:
broker_id_index:
fields: [id]
Price:
tableName: price
columns:
id:
type: integer(8)
autoincrement: true
primary: true
date: date(25)
date_short: date(25)
stock_id: integer(5)
broker_id: integer(5)
trades: integer(9)
nettobuy: decimal(18)
avgbuy: decimal(18)
avgsell: decimal(18)
turnover: decimal(18)
shares_total: integer(9)
shares_buy: integer(9)
shares_sell: integer(9)
shares_internal: integer(9)
shares_netto: integer(9)
relations:
Stock:
local: stock_id
foreign: id
type: one
Broker:
local: broker_id
foreign: id
type: one
indexes:
price_dateindex:
fields: [date_short]
price_stockindex:
fields: [stock_id]
Stock:
tableName: stock
columns:
id:
primary: true
type: integer(5)
name: string(255)
exchange: string(50)
relations:
Prices:
class: Price
local: id
foreign: stock_id
type: many
Quotes:
class: Quote
local: id
foreign: stock_id
type: many
indexes:
stock_idindex:
fields: [id]
Quote:
tableName: quote
columns:
stock_id: integer(5)
date: date(25)
date_short: date(25)
price: decimal(18)
turnover: decimal(18)
amount: integer(9)
high: decimal(18)
low: decimal(18)
provider: string(10)
relations:
Stock:
class: Stock
local: stock_id
foreign: id
type: one
indexes:
quote_dateindex:
fields: [date_short]
quote_stockindex:
fields: [stock_id]