# |
Oct 2nd 2016, 16:51 |
michaelze |
hmic: Apparently there are no events fired when a query is created... I already checked that ;) |
# |
Oct 2nd 2016, 16:50 |
michaelze |
hmic: sorry for the long text, I hope I made my point clear ;) |
# |
Oct 2nd 2016, 16:50 |
michaelze |
...sure that that is the query I want to modify... |
# |
Oct 2nd 2016, 16:50 |
michaelze |
...I'm logged in as the superadmin or something). When I call the opt out method I store a boolean value in my behavior that gets queried in the beforeFind() method. The problem is, that the "next" beforeFind() call may not be the call that corresponds to the query I want the opt out to happen... So I was wondering whether it is possible to hook into the query creation because there I can be... |
# |
Oct 2nd 2016, 16:50 |
michaelze |
hmic: My use case is as follows: I have a special column in some of my tables that make a record belong to a certain tenant within my application (tenant_id). I created a behavior that, when attached, automatically adds the required filter to any query. I added another method to the behavior that allows me to opt out of this behavior in case I want to also get records for other tenants (e.g.... |
# |
Oct 2nd 2016, 16:47 |
hmic |
still, whats the usecase? |
# |
Oct 2nd 2016, 16:47 |
hmic |
so i'd inspect that code to see if events are fired, which would give you the opportunity to intervene quite easily |
# |
Oct 2nd 2016, 16:46 |
michaelze |
hmic: The query is created in the Table::query() method. Is that what you asked? |
# |
Oct 2nd 2016, 16:45 |
hmic |
and whats the usecase also? |
# |
Oct 2nd 2016, 16:45 |
hmic |
michaelze, do you know how and when a query is created? |
# |
Oct 2nd 2016, 16:45 |
michaelze |
Hi everyone! Is there a way to modify a query by a behavior the moment it is created instead of the moment that it is executed (beforeFind())? |
# |
Oct 2nd 2016, 16:34 |
michaelze |
lorb: one problem could be that your app is crashing so you won't be able to dump the result... But you could try with as much rows before it is failing. That should give you a pretty good sight into what's happending |
# |
Oct 2nd 2016, 16:32 |
michaelze |
lorb: I personally don't have a lot of experience on that field (especially not with php). But a quick google search revealed this stackoverflow question: http://stackoverflow.com/questions/880458/php-memory-profiling |
# |
Oct 2nd 2016, 16:31 |
lorb |
how would I best figure that out? |
# |
Oct 2nd 2016, 16:31 |
michaelze |
lorb: just an example |
# |
Oct 2nd 2016, 16:31 |
lorb |
I have turned of validation, and looking for pointers where else cake may require this much memory |
# |
Oct 2nd 2016, 16:31 |
michaelze |
lorb: well yeah, obviously. what I mean by this is which part of it... Is it generating a lot of caches of some sort that don't get cleaned up? |
# |
Oct 2nd 2016, 16:30 |
lorb |
well, cakephp is. obviously. running the data directly to mysql gets it done with no trouble |
# |
Oct 2nd 2016, 16:29 |
michaelze |
lorb: okay, that sounds like something else is taking up the majority :) |
# |
Oct 2nd 2016, 16:29 |
michaelze |
lorb: I would guess handling a lot of data is not a common task for a orm... |
# |
Oct 2nd 2016, 16:28 |
lorb |
the records are just a few numbers. the whole data is read from a csv file that has just 3MB |
# |
Oct 2nd 2016, 16:27 |
michaelze |
lorb: have you analyzed what actually takes up all the space? I mean how big is one of your "row" arrays, what else is there sitting around taking up space? |
# |
Oct 2nd 2016, 16:25 |
lorb |
yes, I'm rewriting the code atm to do that, but I don't see why that has to be necessary. 100k is not that much data |
# |
Oct 2nd 2016, 16:25 |
michaelze |
lorb: what about splitting the save operation up into junks? |
# |
Oct 2nd 2016, 16:24 |
lorb |
I'm using saveAssociated() but yeah, I do have an array with 100k records |
# |
Oct 2nd 2016, 16:24 |
michaelze |
lorb: can you tell a little bit more about what you are doing? is it some sort of import? |
# |
Oct 2nd 2016, 16:24 |
lorb |
similaar |
# |
Oct 2nd 2016, 16:23 |
michaelze |
lorb: do you actually create an array with 100k "rows" and then use saveAll to store them? |
# |
Oct 2nd 2016, 16:22 |
lorb |
for some reason cakephp has a fatal error of memory exhaustion when trying to save 100k rows, which shouldn't be a problem with 1G of allowed memory |
# |
Oct 2nd 2016, 16:22 |
lorb |
large amounts = number of records has 6 digits |
# |
Oct 2nd 2016, 16:22 |
lorb |
how can I handle large amounts of data in cakephp2 ? |
# |
Oct 2nd 2016, 16:20 |
michaelze |
(i.e. beforeFind()) |
# |
Oct 2nd 2016, 16:20 |
michaelze |
Hi everyone! Is there a way to modify a query by a behavior the moment it is created instead of the moment that it is executed? |
# |
Oct 2nd 2016, 16:18 |
noibilism |
Helloâ?¦anybody know any nice drag and drop file uploader script out there that can be implemented with cake 3? |
# |
Oct 2nd 2016, 13:30 |
admad |
use gist or pastebin |
# |
Oct 2nd 2016, 13:30 |
admad |
phpcakebaker: show the full stacktrace for the error |
# |
Oct 2nd 2016, 13:26 |
phpcakebaker |
I believe that match the controller name do not need to be loaded or set to a property manually. |
# |
Oct 2nd 2016, 13:24 |
phpcakebaker |
Hello, I am doing the tutorial at http://www.bravo-kernel.com/2015/04/how-to-add-jwt-authentication-to-a-cakephp-3-rest-api/ and I run into an error that I would like to understand and solve. When I add a new user, as instructed in the tutorial I get an error Call to a member function success() on boolean |
# |
Oct 2nd 2016, 10:10 |
kingloui |
it seems that it writes a bad cookie, because it can read a cookie written by cakephp 3.3.4 but when I login again it canâ??t read the cookie |
# |
Oct 2nd 2016, 10:08 |
kingloui |
e |
# |
Oct 2nd 2016, 10:08 |
kingloui |
when I downgrade to cakephp 3.3.4 it is working fin |