# |
Oct 22nd 2009, 09:34 |
ionas |
(which equal) |
# |
Oct 22nd 2009, 09:34 |
ionas |
you will have 4 models, and 4 aliases to those |
# |
Oct 22nd 2009, 09:33 |
ionas |
User HasMany Video | Video BelongsTo User | Video HasMany Comment | Comment BelongsTo Video | Comment BelongsTo User |
# |
Oct 22nd 2009, 09:33 |
t0nic |
ionas ok, I think that answers my concern thanks :) |
# |
Oct 22nd 2009, 09:32 |
NoReGreT |
Phally: yeah, what is it in your opinion i meant |
# |
Oct 22nd 2009, 09:32 |
ionas |
t0nic, maybe someone else understands your question better, I would use the same alias only for one and the same "reference" to the same concept. Basically if you do $this->Foo->find() or $this->Foo->Bar->Foo->find() should make no difference |
# |
Oct 22nd 2009, 09:32 |
Phally |
NoReGreT: i did no say that |
# |
Oct 22nd 2009, 09:32 |
NoReGreT |
s/that you/the/ |
# |
Oct 22nd 2009, 09:32 |
Ceeram |
line #231 and #237 (which is teh same test btw) |
# |
Oct 22nd 2009, 09:32 |
NoReGreT |
Phally: i see, so that you concept you showed me is better ? |
# |
Oct 22nd 2009, 09:31 |
Phally |
) |
# |
Oct 22nd 2009, 09:31 |
Phally |
NoReGreT: and role based (User HABTM Group |
# |
Oct 22nd 2009, 09:31 |
Ceeram |
ok thx, then how can that test pass with you its expecting [Product][price] |
# |
Oct 22nd 2009, 09:31 |
Phally |
NoReGreT: not really, that is db based |
# |
Oct 22nd 2009, 09:30 |
Ceeram |
that would be in Product array i would say |
# |
Oct 22nd 2009, 09:30 |
markstory |
[0][price] |
# |
Oct 22nd 2009, 09:30 |
Ceeram |
and i mean data structure for MIN(Product.price) as price |
# |
Oct 22nd 2009, 09:30 |
t0nic |
I know you can't use the same alias on both sides of model1->model2 |
# |
Oct 22nd 2009, 09:30 |
Ceeram |
what would you say this would return: $result = $Product->find('all',array('fields'=>array('Product.type','MIN(Product.price) as price'),'group'=> 'Product.type',)); |
# |
Oct 22nd 2009, 09:30 |
t0nic |
*must* i use distinct aliases for User in a chain like User<-Video->Comment->User |
# |
Oct 22nd 2009, 09:29 |
markstory |
Ceeram: and I run the tests in 5.2.10 and 4.4.9 |
# |
Oct 22nd 2009, 09:29 |
ionas |
t0nic, I do not see your issue there |
# |
Oct 22nd 2009, 09:28 |
ionas |
t0nic, 'AliasName' => array('className' => 'ModelName') |
# |
Oct 22nd 2009, 09:28 |
Ceeram |
hmm |
# |
Oct 22nd 2009, 09:28 |
markstory |
I don't get any of the fails you do. |
# |
Oct 22nd 2009, 09:28 |
markstory |
Ceeram: no |
# |
Oct 22nd 2009, 09:27 |
Ceeram |
markstory: you dont get fail on ModelRead test? |
# |
Oct 22nd 2009, 09:27 |
t0nic |
http://is.gd/4vVNL "However, aliases must be unique both within a single model and on both sides of a belongsTo/hasMany or a belongsTo/hasOne relationship. Choosing non-unique names for model aliases can cause unexpected behavior." |
# |
Oct 22nd 2009, 09:27 |
ionas |
Comment: id, created, body, user_id, username, email, url - the latter 4 maybe NULL - its either user_id or those 3 fields filled with data |
# |
Oct 22nd 2009, 09:26 |
ionas |
you don't need an author model just because you "could" build it |
# |
Oct 22nd 2009, 09:26 |
ionas |
I don't get that |
# |
Oct 22nd 2009, 09:26 |
ionas |
hm? |
# |
Oct 22nd 2009, 09:26 |
t0nic |
just cuz all the names would match up |
# |
Oct 22nd 2009, 09:25 |
t0nic |
it'd be easier for comments to have a "User" and not an "Author [user]" |
# |
Oct 22nd 2009, 09:25 |
t0nic |
ionas: I'm wondering if I *must* |
# |
Oct 22nd 2009, 09:24 |
ionas |
generally you can reference one model with two different aliases |
# |
Oct 22nd 2009, 09:24 |
ionas |
or User hasMany Friend HasMany User |
# |
Oct 22nd 2009, 09:24 |
ionas |
like User HasMany Video HasMany Comment BelongsTo User |
# |
Oct 22nd 2009, 09:23 |
ionas |
you can have recursion if you mean that |
# |
Oct 22nd 2009, 09:22 |
t0nic |
the book says it can cause "unexpected behavior" so I'm not sure how to test for it |
# |
Oct 22nd 2009, 09:22 |
t0nic |
can Question->Answer->User also have "answer belongsTo "User", or must I make it "Answerer"? |