[CDBI] Two has_a Relationships to the Same Table?

Dave Mabe davemabe at gmail.com
Wed Apr 23 14:26:41 BST 2008


package StockTickr::Trade;
...
__PACKAGE__->has_a(marketdata => 'StockTickr::MarketData'); # this
relationship has worked fine
__PACKAGE__->has_a(yesterday_marketdata => 'StockTickr::MarketData');  # new
column, yesterday_marketdata is a new column in this table
...

On Wed, Apr 23, 2008 at 9:13 AM, Mertel, Mark <mm330g at att.com> wrote:

>  Did you use the mappings method? How about including your code snippet.
>
>
>
> ---
>
> Mark Mertel
>
> TEK systems
>
> Desk: 425.288.7214
>
> Mobile: 206.353.2663
>
>
>  ------------------------------
>
> *From:* classdbi-bounces at svr02.digitalcraftsmen.net [mailto:
> classdbi-bounces at svr02.digitalcraftsmen.net] *On Behalf Of *Dave Mabe
> *Sent:* Wednesday, April 23, 2008 6:06 AM
> *To:* ClassDBI at svr02.digitalcraftsmen.net
> *Subject:* [CDBI] Two has_a Relationships to the Same Table?
>
>
>
> I've got one table (A) with a has_a relationship to another table (B).
> I'd like to add another column to table A that is the foreign key for a
> record in table B.
>
> I tried to simply add the column and then put another has_a relationship
> in the class for table A, but I get "Column does not exist" errors.  I tried
> adding the new column name as a TEMP column in the class for table B and
> also adding it as a table_alias for table B both of which give the same
> error.
>
> Any idea how to do this?  Is it possible to set up another class for table
> B for the second relationship (still pointing to the data in the same
> table)?
>
> TIA
>
> --
> Dave Mabe
> StockTickr - Trader Performance Analysis
> We Make Traders More Profitable
> http://www.stocktickr.com/
>
> Every trade I make is blogged:
> http://blog.stocktickr.com/
>



-- 
Dave Mabe
StockTickr - Trader Performance Analysis
We Make Traders More Profitable
http://www.stocktickr.com/

Every trade I make is blogged:
http://blog.stocktickr.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20080423/621f159f/attachment.htm 


More information about the ClassDBI mailing list