# |
Jul 14th 2017, 13:46 |
slackebot |
website, I've tried to make a count with only messages (as its a left join, it would be ok), and the result is much faster, is there somehow generate the count for the paginator component? the query generated query is: ``` SELECT ( COUNT(*) ) AS `count` FROM message_board MessageBoard LEFT JOIN users Users ON Users.id = (MessageBoard.user_id) LEFT JOIN users Friends ON Friends.id = ( MessageBoard.destination_user_id ) ``` What |
# |
Jul 14th 2017, 13:46 |
diego182 |
Hello all, I have a MySQL table with storage Engine InnoDB and it has arround ~400000 records on it, this table is a message table and has 2 fk with the users table, one for origin user, other for destination user, I'm running on PHP 7 and MySQL 5.7, the associations are loaded with LEFT join. My problem is that the count query needed due to pagination is really slow, it takes about something between 5 and 10 seconds to be done, so its slo |
# |
Jul 14th 2017, 13:33 |
neon1024 |
Just an out-loud question really. Is there a convention for indenting return lines in a docblock if the line runs over the character limit of the line. I see some places a single tab indent to show it’s a continuation of the previous line. Anyone have thoughts? |
# |
Jul 14th 2017, 13:28 |
spriz |
I saw some entities was created in the afterSave/beforeSave logic |
# |
Jul 14th 2017, 13:28 |
spriz |
so if somewhere in the before/after save of entity A there's a failure of saving a completely "unrelated" entity - that sounds reasonable for this error |
# |
Jul 14th 2017, 13:27 |
spriz |
Ah |
# |
Jul 14th 2017, 13:27 |
lorenzo |
if you call save() on another table in a behavipr or after save, then it has the power to roll everything back |
# |
Jul 14th 2017, 13:27 |
spriz |
I see! I'll see if I can find anything weird going on :) |
# |
Jul 14th 2017, 13:26 |
lorenzo |
it can be a rules error, for example |
# |
Jul 14th 2017, 13:26 |
lorenzo |
usually a behavior of a before/after save that had an error |
# |
Jul 14th 2017, 13:18 |
spriz |
Any tips on debugging a nested transaction rollback? :thinking_face: |
# |
Jul 14th 2017, 12:17 |
nicolas.r |
ty |
# |
Jul 14th 2017, 12:09 |
hmic |
nicolas.r: try ->first() |
# |
Jul 14th 2017, 12:03 |
nicolas.r |
Hi guys just a simple question. How can I have a single result instad toding this ; $this->Actions->findById(1)->toArray()[0] |
# |
Jul 14th 2017, 11:43 |
neon1024 |
“The constructor for Cake\Core\Exception\Exception has been extended, allowing you to pass in hashes of data.” |
# |
Jul 14th 2017, 11:42 |
neon1024 |
The book says |
# |
Jul 14th 2017, 11:40 |
spriz |
@neon1024 if you come up with any other pros - bring them! :) |
# |
Jul 14th 2017, 11:40 |
spriz |
oh, and the http code I guess |
# |
Jul 14th 2017, 11:40 |
spriz |
Only pro I know is the templating :slightly_smiling_face: |
# |
Jul 14th 2017, 11:38 |
neon1024 |
Hah, rtfm! |
# |
Jul 14th 2017, 11:36 |
neon1024 |
Can anyone tell me what advantages that will bring me? |
# |
Jul 14th 2017, 11:36 |
neon1024 |
The book says the latter, https://book.cakephp.org/3.0/en/development/errors.html#creating-your-own-application-exceptions |
# |
Jul 14th 2017, 11:36 |
neon1024 |
Should my plugins exceptions extend \Exception or \Cake\Core\Exception |
# |
Jul 14th 2017, 11:29 |
josexato |
@hmic, yes actually it worked directly thanks |
# |
Jul 14th 2017, 11:25 |
neon1024 |
Think I’ll try extending the ObjectRegistry class first and see how I get on :slightly_smiling_face: #rubberduck |
# |
Jul 14th 2017, 11:23 |
neon1024 |
Not sure I need all the collection methods, could be too much overhead perhaps |
# |
Jul 14th 2017, 11:21 |
neon1024 |
Or would I be better off using the core’s Registry class? |
# |
Jul 14th 2017, 11:21 |
neon1024 |
I am writing my own collection class, in that I want a class to store a number of things. Can I implement the Cake Collection class for this? So that I can use it’s methods. Is it as simple as just adding my array of class objects to the Collection? |
# |
Jul 14th 2017, 10:21 |
hmic |
if you follow convention and new/patchEntity with the relation, that does just work |
# |
Jul 14th 2017, 10:14 |
josexato |
@hmic, I want to save a menu entity that has many dishes, I am sending a json Menu{id:1, dishes[{id:1,name:"food1"},{id:2,name:"food2"},{id:3,name:"food3"}...]} |
# |
Jul 14th 2017, 10:09 |
admad |
hmic: in 3.next (3.5) you can already used your own pagination class with the paginator component |
# |
Jul 14th 2017, 10:04 |
dereuromark |
bottom line: "we could possibly implement an improved sort mapping adjacent to the existing sortWhitelist feature." |
# |
Jul 14th 2017, 10:04 |
hmic |
josexato: why not contain the dishes when querying the menus? |
# |
Jul 14th 2017, 10:03 |
dereuromark |
=> https://github.com/cakephp/cakephp/issues/10028#issuecomment-272812357> - but also see <https://github.com/cakephp/cakephp/issues/7324>, <https://github.com/cakephp/cakephp/pull/9791/files |
# |
Jul 14th 2017, 10:03 |
hmic |
at the current state i'd rather remove the paginator from the core (and add it to the app-template only or create the class in the app namespace when used by bake) |
# |
Jul 14th 2017, 10:02 |
josexato |
hello, I am sending a json with an array of many elements of an entity (menus hasmany dishes) I am using a for and patch to loadthem is this the best way to load an array or is there one command to load them all directly? |
# |
Jul 14th 2017, 10:02 |
neon1024 |
Wow, a four year old ticket |
# |
Jul 14th 2017, 10:02 |
dereuromark |
the solution is simple: mappings :slightly_smiling_face: I recommended this many months ago for the paginator rewrite |
# |
Jul 14th 2017, 10:02 |
hmic |
feel free to implement and PR! |
# |
Jul 14th 2017, 09:58 |
johnwayne |
BUt it would be nice to have.... there was already an Issue on github -> https://github.com/cakephp/cakephp/issues/1957 |
# |
Jul 14th 2017, 09:52 |
hmic |
stock paginator can't do much like that. it's not difficult to implement though |