# |
Jul 19th 2021, 12:17 |
admad |
Overtime I imagine I would be trying to remember whether a chunk of HTML is coming from a Cake template or a .vue file. |
# |
Jul 19th 2021, 12:16 |
admad |
@isvyas what's the benefit of having the layout and `templates/Pages/greet.php` generated through Cake? Having some on your HTML as Cake templates and that for components as pure .vue files doesn't seem very good for management. |
# |
Jul 19th 2021, 11:37 |
rudy1976s |
Hello !!! I am writing a text for a table which has a json column. I have warnings by phpunit related : it seems that fixture is not able to work with json data. is that possible ? is there something to know about it ? |
# |
Jul 19th 2021, 11:31 |
isvyas |
Hi Guys, Checkout my latest blog post on how to integrate Vue.js with CakePHP: https://ishanvyas.hashnode.dev/integrate-vuejs-with-cakephp-framework Feedback appreciated :raised_hands::skin-tone-3: Let me know if I'm missing anything. Also, suggest the topics in which you guys need blog posts so if I have knowledge about it I can create an article on it. |
# |
Jul 19th 2021, 11:24 |
admad |
@slack1780 this->element('nav', ['id' => $identity]) |
# |
Jul 18th 2021, 22:38 |
kevin.pfeifer |
yes, the identity object is not automatically set in the view either you get it via the request object (same way as in controller) inside your template or set the identity variable in the appcontroller so its present everywhere without going through the request everytime |
# |
Jul 18th 2021, 21:22 |
kevin.pfeifer |
there is also this plugin https://github.com/icings/menu which uses the KnpMenu But I never used it so :man-shrugging: |
# |
Jul 18th 2021, 20:47 |
kevin.pfeifer |
no problem, just type it in and someone will help you :) |
# |
Jul 18th 2021, 20:32 |
kevin.pfeifer |
:thinking_face: then you should regenerate the model cache i guess ```bin/cake cache clear_all``` |
# |
Jul 18th 2021, 20:26 |
kevin.pfeifer |
well you should get used to it ;) |
# |
Jul 18th 2021, 20:26 |
kevin.pfeifer |
`chmod +w -R /var/www/clients/client2/web2/web/tmp/` |
# |
Jul 18th 2021, 20:25 |
kevin.pfeifer |
well you tmp directory doesn't seem to be writeable |
# |
Jul 18th 2021, 20:13 |
kevin.pfeifer |
to test it you can just add `$this->Authorization->skipAuthorization();` at the start of the function you want to test |
# |
Jul 18th 2021, 20:04 |
kevin.pfeifer |
leave everything else just like https://github.com/cakephp/app/blob/master/config/routes.php#L58 so basically you only have `$builder->fallbacks();` in there |
# |
Jul 18th 2021, 20:04 |
slackebot2 |
function``` |
# |
Jul 18th 2021, 20:04 |
kevin.pfeifer |
remove/comment out both ```$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']); $builder->connect('/pages/*', 'Pages::display');``` the fact that you have a pages table remove that default functionality After that you should be able to go to ```/pages => index function /pages/add => add function /pages/edit/<ID> => edit function /pages/view/<ID> => view function /pages/delete/<ID> => delete |
# |
Jul 18th 2021, 19:55 |
kevin.pfeifer |
index => table of all present entries view => detail view of one entry add => form to add an entry edit => form to edit an entry delete => just functionality to delete a function These functions are auto-generated from the bake CLI tool inside your controller |
# |
Jul 18th 2021, 19:53 |
kevin.pfeifer |
the display method is only used in the Pages Controller for "static" page-templates which are set in the `templates/pages` directory What you want is the index function if you want a table of all present entries for the `pages` table (exactly what the bake CLI tool auto-generates for you) |
# |
Jul 18th 2021, 19:41 |
kevin.pfeifer |
if you call that url normally at least GET should be in there |
# |
Jul 18th 2021, 19:41 |
kevin.pfeifer |
not the functions in your controllers |
# |
Jul 18th 2021, 19:41 |
kevin.pfeifer |
`$this->request->allowMethod` should have one of the HTTP Methods like GET, POST, PUT, DELETE etc. |
# |
Jul 18th 2021, 19:28 |
kevin.pfeifer |
well what url are you calling when that error occurs |
# |
Jul 18th 2021, 19:27 |
kevin.pfeifer |
or do you actually have a table called `pages` where you want to show entries like any other table? |
# |
Jul 18th 2021, 19:20 |
kevin.pfeifer |
usually `/pages/*` is routed to the display function of the Display Controller https://github.com/cakephp/app/blob/master/config/routes.php#L58 Is that still the way how you have pages implemented in your code? |
# |
Jul 18th 2021, 16:15 |
cnizzardini |
Now this really depends on your application if this is even possible. Seems best for APIs. |
# |
Jul 18th 2021, 16:15 |
cnizzardini |
^ Next time I need to rewrite something I am trying this approach. |
# |
Jul 18th 2021, 16:14 |
cnizzardini |
https://martinfowler.com/bliki/StranglerFigApplication.html |
# |
Jul 18th 2021, 11:08 |
kevin.pfeifer |
expecting that your database structure follows the cakephp naming schema |
# |
Jul 18th 2021, 11:08 |
kevin.pfeifer |
I would start a new one, use the `bin/cake bake` tool as much as possible to auto-generate the code which can be derived from the table and column names and copy-paste the custom code (where you probably have to adjust a bit more) |
# |
Jul 18th 2021, 11:02 |
vikas |
*Suggestions*: Will it be advisable to upgrade a legacy cake2 application to cake4 or completely rewrite the whole stuff?? |
# |
Jul 18th 2021, 08:25 |
hmic |
the default pathPrefix is files/ |
# |
Jul 18th 2021, 08:25 |
hmic |
lzz: https://book.cakephp.org/4/en/views/helpers/html.html#linking-to-videos-and-audio-files |
# |
Jul 18th 2021, 07:08 |
lzz |
Where/What folder should I create for video? $this->Html->media()? I tried media and files inside webroot but I get 404 for both of them. |
# |
Jul 17th 2021, 21:54 |
alamnaryab |
thank you @kevin.pfeifer this worked |
# |
Jul 17th 2021, 21:41 |
slackebot2 |
->where(['FeeRates.status'=>1,'FeeRates.academic_session_id'=> $s_id ]) ->order(['FeeRates.sort'=>'asc']); } ]) ->all();``` |
# |
Jul 17th 2021, 21:41 |
kevin.pfeifer |
you need to pass that variable inside that anonymous function via `use` https://www.php.net/manual/en/functions.anonymous.php ```$s_id = 1; $school_classes = $this->SchoolClasses->find() ->where(['SchoolClasses.status'=>1]) ->order(['SchoolClasses.sort'=>'asc']) ->contain([ 'FeeRates'=>function($q) use ($s_id){ return $q |
# |
Jul 17th 2021, 21:27 |
slackebot2 |
->where(['FeeRates.status'=>1,'FeeRates.academic_session_id'=> $s_id ]) ->order(['FeeRates.sort'=>'asc']); } ]) ->all();``` How can I do it. or any other alternate. |
# |
Jul 17th 2021, 21:27 |
alamnaryab |
I want to make condition on inside `contain` but external variable is not accessable ```$s_id = 1; /**** this variable is not accessable inside contain */ $school_classes = $this->SchoolClasses->find() ->where(['SchoolClasses.status'=>1]) ->order(['SchoolClasses.sort'=>'asc']) ->contain([ 'FeeRates'=>function($q){ return $q |
# |
Jul 17th 2021, 21:22 |
alamnaryab |
Hi frinds |
# |
Jul 17th 2021, 13:15 |
kevin.pfeifer |
I know that tables !== complexity of the project but still its something countable :) |
# |
Jul 17th 2021, 13:14 |
kevin.pfeifer |
how many tables? |