# |
May 26th 2016, 11:48 |
frzrr |
thats exactly what i've done except through phinx |
# |
May 26th 2016, 11:48 |
frzrr |
yep |
# |
May 26th 2016, 11:46 |
Neon1024x |
http://book.cakephp.org/3.0/en/migrations.html#creating-custom-primary-keys |
# |
May 26th 2016, 11:45 |
frzrr |
using* |
# |
May 26th 2016, 11:44 |
frzrr |
i'm UUIDS so they are not auto incremented |
# |
May 26th 2016, 11:44 |
frzrr |
https://gist.github.com/anonymous/a7c8b148752eb32b58ddb500280874de |
# |
May 26th 2016, 11:44 |
Neon1024x |
I believe that Phinx assumes an id field is auto-increment, it is customisable though |
# |
May 26th 2016, 11:43 |
frzrr |
dont have any auto incremented column, only id as PK should work |
# |
May 26th 2016, 11:43 |
frzrr |
Anyone familiar with phinx? Trying to add a auto incremented column with identity but i get this error: Incorrect table definition; there can be only one auto colu mn and it must be defined as a key |
# |
May 26th 2016, 11:42 |
sab-cakefest |
Do we get the complete code for the session this morning? Or all the sessions? |
# |
May 26th 2016, 11:40 |
makallio85 |
Should it be fixed in cake or in deployer? I guess proper namespacing would be the correct way to fix it |
# |
May 26th 2016, 11:40 |
makallio85 |
Hi. What is policy with global functions and conflicts with other libraries? It seems that deployer/deployer is having conflict with cakephp env() function as you can see from this issue https://github.com/deployphp/deployer/issues/669 |
# |
May 26th 2016, 11:38 |
bernat1 |
Thinking more about it, even with my proposed solution I guess I would be using whatever internal mechanism CakePHP uses when checking that a row exists before insert or update. I'll have to check the source code and do that myself. |
# |
May 26th 2016, 11:35 |
bernat1 |
thanks anyway Neon1024x |
# |
May 26th 2016, 11:34 |
Neon1024x |
I don't know databases in enough detail to know about that, sorry |
# |
May 26th 2016, 11:34 |
Neon1024x |
Sounds a little more like a datasource solution |
# |
May 26th 2016, 11:34 |
bernat1 |
yes |
# |
May 26th 2016, 11:34 |
Neon1024x |
So concurrent writing |
# |
May 26th 2016, 11:33 |
bernat1 |
I could block the table between the check and the insertion, but I'd prefer to not use locks and use the mechanism I described above. |
# |
May 26th 2016, 11:33 |
bernat1 |
my idea might seem a bit convoluted but in short, I want to use a table as a storage pool, several threads can be inserting into that pool, I use hashes to avoid duplicates and check it doesn't exists before inserting a new one. |
# |
May 26th 2016, 11:31 |
Neon1024x |
Sounds identical to me |
# |
May 26th 2016, 11:31 |
bernat1 |
thanks Neon1024x, that looks useful, but I think it's not the same that I need. |
# |
May 26th 2016, 11:23 |
Neon1024x |
bernat1, https://github.com/dereuromark/cakephp-hashid |
# |
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. |