# |
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 |
# |
Jul 1st 2019, 09:00 |
slackebot |
'contents', 'data' => $data ] ); $this->assertNotNull($this->headers['Location']); $this->assertContains('/admin/admin_page?page=1', $this->headers['Location']); } ``` |
# |
Jul 1st 2019, 09:00 |
blancessanchez30 |
@ndm @conehead This is my code. I don't know where did I go wrong ``` public function testIndex() { $this->Admin = $this->generate('Admins', [ 'components' => [ 'Auth' ] ]); //create user data array with valid info $data = []; $data['Admin']['username'] = 1; $data['Admin']['password'] = '123'; //test login action $result = $this->testAction('/admin/login', [ 'method' => 'post', 'return' => |
# |
Jul 1st 2019, 09:00 |
mw_fingoweb |
@conehead: I have tried different name of associations, but it doesn't work either. In this controller I'm using only Archive tables. |
# |
Jul 1st 2019, 08:57 |
ndm |
@ra7bi If you need to use access that object in your controller/view, then CakePDF is probably not ment for you. The main purpose of CakePDF is to remove the need to communicate with the engine. If all you need to do is to construct the object differently, then override the `output()` method in your custom engine class accordingly and construct the object the way you need to. |
# |
Jul 1st 2019, 08:57 |
conehead |
https://cakesf.slack.com/archives/C053DPNGT/p1560855039286100 |
# |
Jul 1st 2019, 08:57 |
conehead |
@blancessanchez30 You need mocking? |
# |
Jul 1st 2019, 08:56 |
ra7bi |
Here is the settings i need to control https://tcpdf.org/examples/example_018/ |
# |
Jul 1st 2019, 08:56 |
ra7bi |
example , Need to change the font for some paragraphs and need to add arabic font for some places |
# |
Jul 1st 2019, 08:56 |
conehead |
mw_fingoweb, can you try to rename the association. I had the same problem once, when i had 2 associations with the same name |
# |
Jul 1st 2019, 08:55 |
ra7bi |
the main problem here , i need to add more settings and change the fonts and add more cells from my action |
# |
Jul 1st 2019, 08:55 |
mw_fingoweb |
jtraule: conehead: I have something like this: https://pastebin.com/KzkCAPUS Archive Tables uses different database connection. I need to use UsersTable from archive and define association to OffersTable from Archive and if I have specified 'targetTable' only in hasMany it WORKS CORRECTLY, but if I've added this also in belongsTo it causes loop |
# |
Jul 1st 2019, 08:55 |
ra7bi |
i need to use that object in my Controller/View action |
# |
Jul 1st 2019, 08:54 |
ra7bi |
@ndm Please have a look here https://github.com/FriendsOfCake/CakePdf/blob/master/src/Pdf/Engine/TcpdfEngine.php you can see there is `$TCPDF` object |
# |
Jul 1st 2019, 08:53 |
ndm |
@ra7bi I don't really know what you mean by > the original call of `TCPDFEngine.php` |
# |
Jul 1st 2019, 08:53 |
ndm |
@blancessanchez30 You'll have to add a little more details. Mocking what? What is `$this->headers`? What is the error? What exactly are you trying to test? |
# |
Jul 1st 2019, 08:51 |
jtraulle |
mw_fingoweb: Check the className key for associations and use setTable in initialize of tables being associated if table name does not equal table class name ;) |
# |
Jul 1st 2019, 08:51 |
blancessanchez30 |
Good day, does anyone here tried PHPUnit in cakephp with checking sessions? :slightly_smiling_face: I already tried mocking but when I use `$this->headers['Location']`, it always returns an error |
# |
Jul 1st 2019, 08:50 |
conehead |
Can you try ``` $this->hasMany('YourModel') ->setTable('YourTable'); ``` |
# |
Jul 1st 2019, 08:50 |
ndm |
Use the `className` option if your class resides outside the conventions. The `targetTable` option is for "edge cases", for example when you need to build the association dynamically based on already constructed table objects. |
# |
Jul 1st 2019, 08:48 |
mw_fingoweb |
@conehead: I know it's not documented in Web docs, but I have found it in PHPDoc comment above the function :D |
# |
Jul 1st 2019, 08:47 |
conehead |
mw_fingoweb: targetTable is not a valid key. Check https://book.cakephp.org/3.0/en/orm/associations.html#hasmany-associations |
# |
Jul 1st 2019, 08:47 |
mw_fingoweb |
jtraulle: generally it sould be possible to use this key with value that will continue with 'default' behavior |
# |
Jul 1st 2019, 08:46 |
jtraulle |
@ra7bi : https://book.cakephp.org/3.0/en/controllers/request-response.html#setting-the-body |
# |
Jul 1st 2019, 08:45 |
ra7bi |
how i can return entire html in response ? |
# |
Jul 1st 2019, 08:41 |
jtraulle |
mw_fingoweb: Explain with the real tables names because it is not clear to me ;) |
# |
Jul 1st 2019, 08:40 |
blancessanchez30 |
Good day, does anyone here tried PHPUnit in cakephp with checking sessions? :slightly_smiling_face: |
# |
Jul 1st 2019, 08:38 |
mw_fingoweb |
I know, it's simplified problem as I mentioned, I have my table class in different namespace and I need 'targetTable' option |
# |
Jul 1st 2019, 08:37 |
jtraulle |
mw_fingoweb: You should be good without specifying targetTable key ;) |
# |
Jul 1st 2019, 08:34 |
neon1024 |
Morning all |
# |
Jul 1st 2019, 08:29 |
mw_fingoweb |
Is this proper way of use targetTable ? It isn't documented, only in PHPDoc |
# |
Jul 1st 2019, 08:28 |
mw_fingoweb |
This code makes endless loop and stackoverflow because of endless creating instance of each other object |
# |
Jul 1st 2019, 08:26 |
mw_fingoweb |
Like here: https://pastebin.com/JFnYqwHP |
# |
Jul 1st 2019, 08:26 |
mw_fingoweb |
And I want to use 'targetTable' option to select instance of table |
# |
Jul 1st 2019, 08:24 |
mw_fingoweb |
I will simplify problem, I have 2 models, Users and Offers, User hasMany Offers and Offer belongsTo User |
# |
Jul 1st 2019, 08:23 |
mw_fingoweb |
Hello, I have some problem with CakePHP 3.8 ORM. I'm not sure if it is bug or I'm wrong but it seems me bugged. Can you tell me if this is bug or I'm using this wrong. |
# |
Jul 1st 2019, 06:33 |
conehead |
Yes sure. Should be possible: https://stackoverflow.com/questions/33129651/access-web-server-on-virtualbox-vagrant-machine-from-host-browser |