# |
May 26th 2016, 11:17 |
bernat1 |
I'd like CakePHP to use the fake primary key, but use the real primary key (the hash field) when saving new entities, and check the entity already exists based on this hash field. |
# |
May 26th 2016, 11:16 |
bernat1 |
Let me share this idea with you: I want to use a hash field as primary key in the database but use an autoincrement field as id for associations in CakePHP. I think this should be possible but the problem will be saving new entities since they will be saved even when the entity already exists in the database (an existing entity with the same hash). |
# |
May 26th 2016, 11:12 |
bernat1 |
would it be a problem that the primary key in a table isn't the same field I define as primary key in CakePHP? |
# |
May 26th 2016, 10:07 |
unorthodox |
Atm SUBSTRING() applies to [original]. |
# |
May 26th 2016, 10:06 |
unorthodox |
Hm. Does anyone have a clue about using sql SUBTRING() on a translated field? |
# |
May 26th 2016, 10:03 |
Neon1024x |
D |
# |
May 26th 2016, 09:58 |
frzrr |
ah, well _getCreated($created); worked wonders, thanks Neon1024x hard to access the correct solutions sometimes :) |
# |
May 26th 2016, 09:56 |
Neon1024x |
If it's datetime, I think you can configure the defalt datetime format in your bootstrap |
# |
May 26th 2016, 09:53 |
frzrr |
yeah sounds like a better solution for the problem since the dates returned should be the same in the entire application |
# |
May 26th 2016, 09:53 |
frzrr |
or no, afterfind is no entity my bad :) |
# |
May 26th 2016, 09:52 |
frzrr |
if thats still available in Cakephp3 ? |
# |
May 26th 2016, 09:52 |
frzrr |
but yea, could do this is like afterFind |
# |
May 26th 2016, 09:52 |
frzrr |
autoFields was the solution :) |
# |
May 26th 2016, 09:47 |
Neon1024x |
$this->Users->find()->select(['id', 'first_name', 'last_name']); |
# |
May 26th 2016, 09:47 |
Neon1024x |
Especially as ->select() for a query is for fields rather than model names |
# |
May 26th 2016, 09:47 |
Neon1024x |
frzrr, Sounds to me like you need an entity mutator method, if I've understood properly |
# |
May 26th 2016, 09:46 |
Neon1024x |
phpcoder, Well that looks like a contained association to me, I think the 1=1 just applies to the queries global conditions, but I'm not 100% certain of that |
# |
May 26th 2016, 09:42 |
frzrr |
issue is that i need to format the created dates for the main table and dont want to have to add all the other tables in the select. |
# |
May 26th 2016, 09:41 |
frzrr |
other than passing in ->select([$this->Model, $this->OtherModel]) a thousand times ? |
# |
May 26th 2016, 09:40 |
frzrr |
is there some way i could add to the ->select() function without altering the already generated select |
# |
May 26th 2016, 09:37 |
phpcoder |
Neon1024x, yes ok but it should add https://gist.github.com/anonymous/7ff67a7838792aeb584bc70e78b66329#file-test-sql-L72 there no ? |
# |
May 26th 2016, 09:33 |
Neon1024x |
It allows the query build to easily append conditions |
# |
May 26th 2016, 09:33 |
Neon1024x |
phpcoder, The 1=1 is added to the query for when there are no WHERE conditions |
# |
May 26th 2016, 09:32 |
birdy247 |
1st day |
# |
May 26th 2016, 09:32 |
birdy247 |
lol |
# |
May 26th 2016, 09:31 |
phpcoder |
guys cake returns this query https://gist.github.com/anonymous/7ff67a7838792aeb584bc70e78b66329 it works but why does it use 1 = 1 here https://gist.github.com/anonymous/7ff67a7838792aeb584bc70e78b66329#file-test-sql-L67 it does not look very well |
# |
May 26th 2016, 09:30 |
neon1024 |
Had 2 crashes as well |
# |
May 26th 2016, 09:30 |
neon1024 |
Dunno really birdy247 all I've done so far is update my laptop / os / packages / code |
# |
May 26th 2016, 09:30 |
Eax |
Ey folks! Cake3 question: I have this LoginController: https://gist.github.com/eaxexe/64442df2e6465a67fe7a0fcd98ad27f7 (It uses Facebook to auth the login, hence no password checking) - My question is: Can anyone see why the cookie simply dissapears after being set and the user being redirected? Thanks! ð??? |
# |
May 26th 2016, 09:29 |
birdy247 |
@neon1024: How is cake fest |
# |
May 26th 2016, 09:29 |
marlinc |
Anyone here going to Amsterdam's train stations by any chance on Saturday? |
# |
May 26th 2016, 09:27 |
neon1024 |
:+1::skin-tone-2: |
# |
May 26th 2016, 09:27 |
birdy247 |
bernat1 thanks also |
# |
May 26th 2016, 09:27 |
birdy247 |
@neon1024: thanks! |
# |
May 26th 2016, 09:26 |
birdy247 |
got there :slightly_smiling_face: |
# |
May 26th 2016, 09:26 |
birdy247 |
phew |
# |
May 26th 2016, 09:23 |
birdy247 |
so I simply need to return $entities; |
# |
May 26th 2016, 09:23 |
birdy247 |
ok |
# |
May 26th 2016, 09:23 |
neon1024 |
Beyond that, my brain has imploded :( |
# |
May 26th 2016, 09:22 |
neon1024 |
Specifically where $alteredData is set |
# |
May 26th 2016, 09:22 |
neon1024 |
Yep, now read the code above that |