# |
May 3rd 2019, 09:07 |
neon1024 |
Is that still a rule in 3.7/ |
# |
May 3rd 2019, 09:07 |
neon1024 |
alphaNumeric? |
# |
May 3rd 2019, 09:05 |
spriz |
It sure does - I would do it that way, but whenver I've used regex validation rule before I usually end up finding another rule that would do the job later :) :) |
# |
May 3rd 2019, 09:03 |
Martin` |
some validation with regex maybe? does that exist? |
# |
May 3rd 2019, 09:00 |
spriz |
Hi folks! I have a field on my entity that should not contain whitespaces - is there some sneaky validation rule I should use rather than writing my own? :) : D |
# |
May 3rd 2019, 08:31 |
kgb.acct.personal |
Got it. I'll see for myself |
# |
May 3rd 2019, 08:30 |
neon1024 |
Although do check yourself, and look at the tests and stuff so your ticket doesn’t get insta-closed |
# |
May 3rd 2019, 08:30 |
neon1024 |
Worth opening a ticket about imho though |
# |
May 3rd 2019, 08:30 |
kgb.acct.personal |
That would work around the issue. Thanks. Though, I personally prefer using `?page=2` it is so much easier to read |
# |
May 3rd 2019, 08:30 |
neon1024 |
Perhaps you’ll need to write your own Paginator? Extend the existing one |
# |
May 3rd 2019, 08:30 |
neon1024 |
It does look a bit fixed to me |
# |
May 3rd 2019, 08:30 |
neon1024 |
https://github.com/cakephp/cakephp/blob/master/src/Datasource/Paginator.php#L175-L176 |
# |
May 3rd 2019, 08:28 |
neon1024 |
Simplistically I suppose you could read the value and set the page to that value in your controller, but not ideal |
# |
May 3rd 2019, 08:28 |
neon1024 |
I’ve never liked things like that which intentionally make things more obscure |
# |
May 3rd 2019, 08:27 |
kgb.acct.personal |
Spec want me to use `?p=1` instead of `?page=1` |
# |
May 3rd 2019, 08:26 |
neon1024 |
So probably just change the config, although I’m not sure why you’d want to change it |
# |
May 3rd 2019, 08:26 |
neon1024 |
https://github.com/cakephp/cakephp/blob/master/src/Controller/Component/PaginatorComponent.php#L286 |
# |
May 3rd 2019, 08:24 |
kgb.acct.personal |
Hi. How can I use other query string instead of `?page=` when paginating? |
# |
May 3rd 2019, 08:23 |
neon1024 |
Morning everyone, happy Friday :tada: |
# |
May 3rd 2019, 06:48 |
admad |
using `UsersRepository::class` that is instead of `'App.Users'` |
# |
May 3rd 2019, 06:47 |
admad |
@maymeow the latter makes refactoring easier if required in future |
# |
May 3rd 2019, 06:42 |
maymeow |
Business logic ``` $this->loadRepository('App.Users'); ... $this->getRepository()->Users->doSomething(); ``` vs ``` repository(UsersRepository::class)->doSomething(); ``` What do you think? |
# |
May 3rd 2019, 02:48 |
hollistergraham123 |
Nvm |
# |
May 3rd 2019, 02:37 |
hollistergraham123 |
Can I not override a behaviors function when extending it |
# |
May 3rd 2019, 01:16 |
daniel.upshaw |
Since it is creating a tree of the `tests` records |
# |
May 3rd 2019, 01:14 |
daniel.upshaw |
Why not do it this way though? ```CREATE TABLE `tests` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(11) unsigned NOT NULL, `name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;``` |
# |
May 3rd 2019, 01:12 |
daniel.upshaw |
And also how you name the foreign keys.. but it looks like you've done that in your table |
# |
May 3rd 2019, 01:12 |
daniel.upshaw |
The trick may be in setting up your foreign key relationships |
# |
May 3rd 2019, 01:11 |
daniel.upshaw |
And you can still use your concatenated keys like normal, but they just aren't primary for that table.. they should still act the same way, but instead I think you would use both concatenated as a `UNIQUE` key |
# |
May 3rd 2019, 01:10 |
daniel.upshaw |
So the safest way I've found is to use an `id` field as your primary |
# |
May 3rd 2019, 01:10 |
daniel.upshaw |
And, it might not support it yet actually! Not sure how closely one has to follow a certain convention |
# |
May 3rd 2019, 01:09 |
daniel.upshaw |
That's right -- Ideally I would set it up that way... And it's probably possible to do this in a Cake way that supports it, but it's may take some digging to find out how |
# |
May 2nd 2019, 23:37 |
waspinator |
it's old, but should give you an idea of something to try |
# |
May 2nd 2019, 23:36 |
waspinator |
@noel https://stackoverflow.com/questions/8070914/how-to-implement-a-self-referencing-parent-id-model-in-cakephp |
# |
May 2nd 2019, 21:04 |
challgren |
@noel http://docs.phinx.org/en/latest/migrations.html |
# |
May 2nd 2019, 20:37 |
noel |
or for that matter how to write migrations / SQL CREATE statements for the things it does support? |
# |
May 2nd 2019, 20:36 |
noel |
@waspinator there isn’t much bake documentation… how would one tell if bake supports something? |
# |
May 2nd 2019, 20:30 |
waspinator |
if it bakes your models, make sure to remove any auto generated code which references a `parents` table |
# |
May 2nd 2019, 20:29 |
waspinator |
oh I see. I haven't had a chance to make one like that yet, so I'm not sure if it's supported by bake |
# |
May 2nd 2019, 20:28 |
noel |
Normal, non-self-referencing many to many associations work fine with bake. I’m not having trouble with those. It’s the self-referencing variety that I’m trying to conquer. |
# |
May 2nd 2019, 20:27 |
noel |
It’s supposed to be self-referencing. |