# |
May 26th 2017, 17:38 |
HenriqueMachado |
Hello! I'm trying to get a Followers/Following system to work on Cake3 I used to get it working on cake1 but.. i'm stuck now.. somebody can help?: https://pastebin.com/CEnfTws2 |
# |
May 26th 2017, 16:46 |
jeremyharris |
:slightly_smiling_face: |
# |
May 26th 2017, 16:46 |
deco |
@jeremyharris Thanks! Of course, pass it an empty array... |
# |
May 26th 2017, 16:39 |
jeremyharris |
or `new Collection([])` |
# |
May 26th 2017, 16:39 |
jeremyharris |
deco `collection([])` |
# |
May 26th 2017, 16:38 |
deco |
Is it possible to create an empty collection? I would like to declare the collection Object before adding Entities to it because I don't really know which Entity type will be appended first... |
# |
May 26th 2017, 16:26 |
chris-andre |
I have replaced logo.png with another logo.png. I have cleared cache. Any idea why logo doesn't change on the website? :S |
# |
May 26th 2017, 15:59 |
jeremyharris |
glad I’m not the only ones who think they’re implemented a little oddly :slightly_smiling_face: |
# |
May 26th 2017, 15:56 |
josh_rodarte |
Yeah. It is silly though as structure changes are often followed with data changes haha. |
# |
May 26th 2017, 15:56 |
iqu |
hmic: Thanks! i got it |
# |
May 26th 2017, 15:52 |
jeremyharris |
I guess the thought was “seeding only happens on initial build” |
# |
May 26th 2017, 15:52 |
jeremyharris |
seeds often require to be run in a point in time where the database is properly set up, so I don’t see any reason why they aren’t mixed in with the migrations |
# |
May 26th 2017, 15:52 |
josh_rodarte |
I agree it would be better. |
# |
May 26th 2017, 15:51 |
jeremyharris |
but that’s a nice way of organizing them, which is better than nothing |
# |
May 26th 2017, 15:50 |
jeremyharris |
@josh_rodarte I’m was hoping for something more like `bin/cake migrations seed` that could be in a deploy hook and just run un-run seeds. would probably require tracking them like migrations are though |
# |
May 26th 2017, 15:47 |
josh_rodarte |
@jeremyharris ```./cake migrations seed --seed=BaseSeed --source=Seeds\0.0.1``` BaseSeed would then directly call seeds in it's folder. I've used this to sort of separate seeds into sets. I will come up with something that separates migrations with the sets eventually... as it is they are kind of disconnected and it can be a problem if I'm doing a full rebuild. |
# |
May 26th 2017, 15:46 |
iqu |
like ->contain(['Tags','Mediafiles','Users.id']) |
# |
May 26th 2017, 15:46 |
iqu |
in controller? |
# |
May 26th 2017, 15:45 |
iqu |
my brain is littlebit slow now.. |
# |
May 26th 2017, 15:44 |
hmic |
is it Users.id or Orders.id |
# |
May 26th 2017, 15:43 |
hmic |
qualify the id |
# |
May 26th 2017, 15:43 |
iqu |
hmic: sry, dont understand? |
# |
May 26th 2017, 15:43 |
hmic |
iqu, specify the table! |
# |
May 26th 2017, 15:41 |
iqu |
any easy fix: Error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in order clause is ambiguous |
# |
May 26th 2017, 15:33 |
hmic |
so: conditions => ['Bids.user_id = OtherBids.user_id', ... ] instead of conditions => [ 'Bids.user_id' => 'OtherBids.user_id', ... ] will do. |
# |
May 26th 2017, 15:32 |
styks1987 |
ok super thanks |
# |
May 26th 2017, 15:31 |
hmic |
but, like i said, you can provide them in one string instead of key => value pairs and it will work |
# |
May 26th 2017, 15:31 |
hmic |
there is no option available to do so if you are using the "conditions" array notation IMHO, only when using ->where() |
# |
May 26th 2017, 15:31 |
hmic |
you do need to tell the orm that the values in your array are not values but identifiers |
# |
May 26th 2017, 15:30 |
hmic |
you do not need to change them |
# |
May 26th 2017, 15:30 |
hmic |
it gets them from the schema automatically |
# |
May 26th 2017, 15:29 |
styks1987 |
ok, do you know where the default types are defined? I don’t know what type to use? I see examples for integer |
# |
May 26th 2017, 15:26 |
hmic |
remember: use leftJoinWith ;-) |
# |
May 26th 2017, 15:26 |
hmic |
it's not available if you use the 'conditions' key in a join definition |
# |
May 26th 2017, 15:26 |
hmic |
its the second parameter to ->where() |
# |
May 26th 2017, 15:24 |
styks1987 |
I don’t see that type int he docs |
# |
May 26th 2017, 15:24 |
styks1987 |
hmic: how would I specify no value? I’d like to keep the array |
# |
May 26th 2017, 15:23 |
styks1987 |
oh, but it made it a string… yea ok you are right |
# |
May 26th 2017, 15:23 |
hmic |
easiest way: just don't do an associative array, but put them like: 'Bids.listing_id = OtherBids.listing_id', ... |
# |
May 26th 2017, 15:23 |
styks1987 |
hmic: or is it because I had them in the wrong order? It appears that I am supposed to put the joining table first in conditions? |
# |
May 26th 2017, 15:22 |
hmic |
you need to tell the orm that this is no data but identifiers |