[Dbix-class] Difference between belongs_to and has_one

Lee Standen nom at standen.id.au
Thu Oct 19 16:56:56 CEST 2006


Belongs to is a child -> parent relationship
Has one is a sibling <-> sibling relationship?

I'm just guessing here.

My response #2 would be that one is an alias for another



On Thu, 19 Oct 2006, Drew Taylor wrote:

> This morning I was doing some work on relationships and ran into this question:
> What is the difference between belongs_to and has_one/might_have?
>
> They seem VERY similar. AFAICT the fundamental difference is that with
> belongs_to cascading delete is turned off, while with has_one
> cascading delete is turned on by default. Is there any other
> differences between these two?
>
> Thanks,
> Drew
> -- 
> ----------------------------------------------------------------
> Drew Taylor                 *  Web development & consulting
> Email: drew at drewtaylor.com  *  Site implementation & hosting
> Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
> ----------------------------------------------------------------
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>
>



More information about the Dbix-class mailing list