# |
Mar 2nd 2018, 18:10 |
savant |
so thats why i think its trying to actually generate a larger pdf |
# |
Mar 2nd 2018, 18:10 |
savant |
more data == more memory usage |
# |
Mar 2nd 2018, 18:10 |
destinydriven |
same cake 2.10.8, same database |
# |
Mar 2nd 2018, 18:10 |
savant |
doubt it |
# |
Mar 2nd 2018, 18:10 |
destinydriven |
same everything |
# |
Mar 2nd 2018, 18:10 |
savant |
same php version? |
# |
Mar 2nd 2018, 18:09 |
savant |
are you using the same cakephp version? |
# |
Mar 2nd 2018, 18:09 |
destinydriven |
@savant same size |
# |
Mar 2nd 2018, 18:09 |
savant |
@destinydriven is the pdf its trying to generate bigger? |
# |
Mar 2nd 2018, 18:09 |
savant |
sure you can do that |
# |
Mar 2nd 2018, 18:09 |
obinoob |
savant that is so cool I'm guessing it should go in Table right after hasMany? |
# |
Mar 2nd 2018, 18:08 |
destinydriven |
CakePdf memory limit issue: My dev server has in php-ini memory_limit: 128M and generates a 16MB pdf file without problem. Production server memory_limit has been bumped to 512M and throws Allowed memory size of 536870912 bytes exhausted (tried to allocate 536870920 bytes). Is there some other explanation as to why a server with 4 times allocated memory? |
# |
Mar 2nd 2018, 18:06 |
obinoob |
savant thats what I did |
# |
Mar 2nd 2018, 18:06 |
admad |
obinoob: most likely this is what you are looking for https://gist.github.com/ADmad/0a451d837f019edf3447 |
# |
Mar 2nd 2018, 18:06 |
savant |
if its not hasMany, dont use hasMany. hasOne is there for a reason |
# |
Mar 2nd 2018, 18:06 |
savant |
if you want to find only one instance for a related table, do a separate query against that table |
# |
Mar 2nd 2018, 18:06 |
savant |
not joins |
# |
Mar 2nd 2018, 18:06 |
savant |
first() only applies to the top-level Table |
# |
Mar 2nd 2018, 18:05 |
obinoob |
err: on = one |
# |
Mar 2nd 2018, 18:05 |
obinoob |
savant the same happens with users... conceptually it is a collection of things, if I know it will return only on item from the table I can use first() and get the things easier... |
# |
Mar 2nd 2018, 18:03 |
savant |
but note: no certificates == your code will break |
# |
Mar 2nd 2018, 18:03 |
savant |
there is no way to do what you want to do without defining a new relationship or making a method in the entity that returns the first certificate |
# |
Mar 2nd 2018, 18:02 |
savant |
similarly, if there were no results, it would be an array of size zero |
# |
Mar 2nd 2018, 18:02 |
savant |
its just a collection of size 1 |
# |
Mar 2nd 2018, 18:01 |
savant |
you _want_ it to make sense, but its still a collection of things |
# |
Mar 2nd 2018, 18:01 |
savant |
the relationship does |
# |
Mar 2nd 2018, 18:01 |
savant |
the limit doesnt decide whether its a single or multiple |
# |
Mar 2nd 2018, 18:00 |
obinoob |
savant yes the relationship is hasMany but it still makes sense since first() === limit => 1, so if it conditions accept 'limit' key I don't see why not return "certificate" object?!? |
# |
Mar 2nd 2018, 17:58 |
lordyuri92 |
hello |
# |
Mar 2nd 2018, 17:55 |
savant |
since the relationship is hasMany |
# |
Mar 2nd 2018, 17:55 |
savant |
cant do that |
# |
Mar 2nd 2018, 17:55 |
obinoob |
so when printing in view instead $users->certificates[0]->number as opposed to $users->certificates->number |
# |
Mar 2nd 2018, 17:54 |
obinoob |
as the query runs separately makes sense I could get an object as within first() etc |
# |
Mar 2nd 2018, 17:53 |
savant |
an array index for what |
# |
Mar 2nd 2018, 17:53 |
obinoob |
I've used 'limit' => 1 but nope |
# |
Mar 2nd 2018, 17:52 |
obinoob |
savant when passing ->contain() optional table (I know that it will exist only one registry matching my rules) instead of getting an array index I would like to know if I can get an object ex: https://pastebin.com/w0jU1Hyb |
# |
Mar 2nd 2018, 17:48 |
savant |
what? |
# |
Mar 2nd 2018, 17:47 |
obinoob |
any chance of getting an object for only one registry within contain() or find('all', ['contain' => [...]]) I've used 'limit' = 1 but still got an array |
# |
Mar 2nd 2018, 17:22 |
inoas |
and a fun weekend! |
# |
Mar 2nd 2018, 17:21 |
inoas |
have a great evening bakers! |
# |
Mar 2nd 2018, 16:58 |
admad |
also checkout `App::shortName(get_class($entity))` |