# |
Jul 1st 2019, 10:55 |
ndm |
@vossen.steven You can configure the cache directly, like `\Cake\Cache\Cache::config('test', ['className' => 'Cake\Cache\Engine\FileEngine', /* .. */])` |
# |
Jul 1st 2019, 10:48 |
slackebot |
'test_', ], ], ]; ``` I dont know if this is the 'correct' way but I could use this cache key when I queried in the initialize of the appcontroller Now with the deprecation Plugin::load I simply switched to $this->addPlugin, and now I get the error that the cache key doesnt exist I assume the bootstrapping of plugins happens after the bootstrap of application, while with Plugin::load the bootstrapping happened instantly |
# |
Jul 1st 2019, 10:48 |
vossen.steven |
Hey guys, what would be the best way to dynamically add cache keys from plugins? I used to do something like this ``` Plugin::load('Test', ['bootstrap' => true]); ``` In the bootstrap from test I would ``` Configure::load('Test.cache'); ``` And in the cache file I had ``` return [ 'Cache' => [ 'test' => [ 'className' => 'Cake\Cache\Engine\FileEngine', 'path' => CACHE . 'test/', 'prefix' => |
# |
Jul 1st 2019, 10:29 |
ndm |
@mw_fingoweb I see, but that's a different problem? You'd have to elaborate on that, explain what "doesn't work" means in that context, and show your saving code and the data that you're trying to save. |
# |
Jul 1st 2019, 10:15 |
conehead |
Although this is not nice coding. checkfunct should throw an exception. funct1 should catch that exception and update the response |
# |
Jul 1st 2019, 10:13 |
a.didier |
found myself an answer that seems to work : ``` $this->render("error"); $this->response->send(); $this->_stop(); ``` |
# |
Jul 1st 2019, 10:12 |
mw_fingoweb |
@ndm: I've tried 'className' => 'App\Model\Table\Archive\OffersTable', but saving with associations doesn't work |
# |
Jul 1st 2019, 10:10 |
mw_fingoweb |
And offers initilize instance of Users table, UsersTable initialize offers table instance and this is inifinite |
# |
Jul 1st 2019, 10:09 |
mw_fingoweb |
jtraulle: I don't have Query because of infinite loop of initializing tables :D I'm loading midel with TableRegistry::getTableLocator()->get("Archive/Offers"); |
# |
Jul 1st 2019, 10:01 |
a.didier |
(CakePHP 2.10) |
# |
Jul 1st 2019, 10:01 |
slackebot |
want to do is to use `checkfunct()` to render a different view and skip all the instruction in `funct1()`. `checkfunct()` will always render an error view but with a custom message because it will be used in many other "normal" functions. I tried to put `$this->render("MyErrorView")` in the `checkfunt() `but it keeps rendering the `funct1()` view. Is there is any way to make `checkfunct()` render a view and stop everything else ? |
# |
Jul 1st 2019, 10:01 |
a.didier |
Hello all :wave: Quick question : I have something like this => ``` [...] private checkfunct() { [... do stuff...] if(error) { // render an error view } } public funct1 () { $this->checkfunct(); [some stuff that should be executed if there is an error in checkfunct()] } [...] ``` I have a route that connect `funt1()`, so when i call it on a normal situation it should render it's default view : `funct1.ctp` . What i |
# |
Jul 1st 2019, 09:51 |
a.didier |
Hello all :wave: Quick question : I have something like this => ``` [...] public funct1 () { } [...] ``` |
# |
Jul 1st 2019, 09:46 |
jtraulle |
:mw_fingoweb : Depending how you are loading your association when querying, if an user has a list of offers and each offer belongs to a user and the user object is loading its list of belonging offers and so on, this explains the recursivity problem. |
# |
Jul 1st 2019, 09:42 |
jtraulle |
:mw_fingoweb : What is your ORM query in the end ? |
# |
Jul 1st 2019, 09:37 |
ndm |
@mw_fingoweb `className` generally works fine. If you still have an infinite loop, then your problem might be somewhere else, or you're not using the option as intended. |
# |
Jul 1st 2019, 09:36 |
ndm |
@blancessanchez30 Sounds like an possibly empty response body. Check the headers too, check `$this->response`, etc... Add breakpoints (or debug output/logging) in your application and in `ControllerTestCase::_testAction()` to see whether things are being invoked as expected, where the code might bail out, etc... |
# |
Jul 1st 2019, 09:34 |
mw_fingoweb |
But this makes infinite loop |
# |
Jul 1st 2019, 09:33 |
mw_fingoweb |
I need working targetTable in 2 directions |
# |
Jul 1st 2019, 09:33 |
mw_fingoweb |
Unfortunatelly className doesn't work :( |
# |
Jul 1st 2019, 09:23 |
challgren |
@ra7bi this is my use of it |
# |
Jul 1st 2019, 09:21 |
challgren |
Is gitlab slow for anyone else? |
# |
Jul 1st 2019, 09:20 |
ra7bi |
will check it |
# |
Jul 1st 2019, 09:18 |
challgren |
https://github.com/FriendsOfCake/CakePdf/blob/master/src/Pdf/CakePdf.php |
# |
Jul 1st 2019, 09:17 |
challgren |
You could use CakePdf() instead of the ViewBuilder |
# |
Jul 1st 2019, 09:17 |
ra7bi |
now , it can render PDF but you need to modify the plugin or extend the engine to take control over the Pdf engine |
# |
Jul 1st 2019, 09:16 |
ra7bi |
@challgren im just now working , the problem is not with the engine itself , the main point is the plugin should have in somehow access to the Pdf object from View or controller to be more fixable |
# |
Jul 1st 2019, 09:15 |
blancessanchez30 |
Yep already tried code in stackoverflow, and when I `debug($result)` it always returns to null |
# |
Jul 1st 2019, 09:14 |
ndm |
@blancessanchez30 "_Not working_" as in? If the missing `Location` header is the problem, then start with inspecting what exactly the response is, ie look what `$result` contains, what `$this->headers` contains, etc... |
# |
Jul 1st 2019, 09:14 |
challgren |
@ra7bi could you gist your engine? |
# |
Jul 1st 2019, 09:12 |
ra7bi |
@challgren that is what im doing now |
# |
Jul 1st 2019, 09:12 |
challgren |
But the biggest issue is not being able to load a different engine in CakePDF |
# |
Jul 1st 2019, 09:11 |
challgren |
@ra7bi Have you considered forking cakepdf into your own fork and modifying the code there and then including your repo in composer? |
# |
Jul 1st 2019, 09:09 |
blancessanchez30 |
:,'( |
# |
Jul 1st 2019, 09:08 |
blancessanchez30 |
Still not working :S |
# |
Jul 1st 2019, 09:06 |
ndm |
@blancessanchez30 You should probably use `assertArrayHasKey()` instead of `assertNotNull()` to avoid hard errors... I guess the actual problem is that the `Location` header isn't being set? |
# |
Jul 1st 2019, 09:02 |
blancessanchez30 |
Haha. Are there any suggestions about the code? :slightly_smiling_face: |
# |
Jul 1st 2019, 09:01 |
ndm |
eeeeeww... old cake :slightly_smiling_face: |
# |
Jul 1st 2019, 09:00 |
blancessanchez30 |
That is CakePHP 2 |
# |
Jul 1st 2019, 09:00 |
ra7bi |
Thanks @ndm |
# |
Jul 1st 2019, 09:00 |
ra7bi |
:white_frowning_face: i was thinking if there is a way to return the engine object `$TCPDF` from the plugin to controller/action but it seems hard , will use TCPDF without the plugin |