# |
Jun 18th 2021, 11:07 |
kevin.pfeifer |
@neon1024 just FYI: If you manually return a response inside your action then you don't need to do that (like when returning ajax directly) |
# |
Jun 18th 2021, 11:06 |
neon1024 |
Ace, thanks @kevin.pfeifer |
# |
Jun 18th 2021, 11:05 |
kevin.pfeifer |
```$this->autoRender = false;``` |
# |
Jun 18th 2021, 11:05 |
neon1024 |
I still get a missing template exception |
# |
Jun 18th 2021, 11:05 |
neon1024 |
How do I disable a template render for a controller action? I’ve tried `$this->render(null)` `$this->viewBuilder->disableAutoLayout()` and `$this->viewBuilder()->setTemplate(null)` |
# |
Jun 18th 2021, 08:38 |
paolo.bragagni |
ajax |
# |
Jun 18th 2021, 08:10 |
paolo.bragagni |
there is a way? |
# |
Jun 18th 2021, 08:04 |
paolo.bragagni |
hi I'm trying to get in form.twig the name of the 'title' in associated table |
# |
Jun 18th 2021, 06:01 |
admad |
@angelxmoreno Debug if the crud action is using your table class |
# |
Jun 18th 2021, 02:45 |
angelxmoreno |
next CRUD Q: I am on friendsofcake/crud 5.5.1 and cakephp/cakeph 3.9.10, I need help debugging why CRUD wont validate my request data https://gist.github.com/angelxmoreno/0581c7ddc95325c40fd42a9166450670 |
# |
Jun 18th 2021, 01:58 |
angelxmoreno |
@admad just wanted to follow up on your assist. Your point gave me insight and I went with a simpler solution than i originally anticipated. Route rules did the job just like you implied! |
# |
Jun 18th 2021, 01:56 |
davinci |
I'm not sure either. :) Hoping someone here might know |
# |
Jun 18th 2021, 01:50 |
bmudda |
Not sure you can create migration snapshot for single table. You might have to write it manually. |
# |
Jun 18th 2021, 01:46 |
davinci |
@bmudda that seems to be talking about an entire snapshot, not a single table migration |
# |
Jun 18th 2021, 01:45 |
bmudda |
@davinci https://book.cakephp.org/migrations/2/en/index.html#generating-migrations-from-an-existing-database |
# |
Jun 18th 2021, 01:20 |
davinci |
(via CLI, not just by looking at it :) |
# |
Jun 18th 2021, 01:16 |
davinci |
Can I create a migration file from an existing table? |
# |
Jun 17th 2021, 18:41 |
kevin.pfeifer |
@joey.mukherjee well I was just referring to a belongsToMany connection, but if you are happy saving the json in your column then go for that :) |
# |
Jun 17th 2021, 18:30 |
joey.mukherjee |
That is what I want... Neat! I'm not sure why it says something about time zones in the beginning. Thank you for the pointer! |
# |
Jun 17th 2021, 18:26 |
admad |
https://book.cakephp.org/4/en/orm/associations.html#using-the-through-option |
# |
Jun 17th 2021, 18:25 |
admad |
s/file type/field type |
# |
Jun 17th 2021, 18:25 |
admad |
https://book.cakephp.org/4/en/orm/saving-data.html#saving-complex-types |
# |
Jun 17th 2021, 18:24 |
joey.mukherjee |
@ndm I do have a junction table! Can I use that somehow? @admad That sounds useful! Is there a routine in the middle where I can modify the input/output? How do I set the file type in the schema anyway? Is that a MySQL thing? I am converting from old saved data to my new more efficient save that I would like to modify the data a bit... |
# |
Jun 17th 2021, 18:19 |
admad |
"I save them as a json_encoded string in the database" Set the file type to "json" in table's schema, then cake will handle the string to array and array to string conversion for you |
# |
Jun 17th 2021, 18:17 |
kevin.pfeifer |
@joey.mukherjee so you don’t have a junction table which connects your main table with the “other” table? |
# |
Jun 17th 2021, 18:15 |
kevin.pfeifer |
I also learned new things :) |
# |
Jun 17th 2021, 18:15 |
kevin.pfeifer |
@ndm :clap: |
# |
Jun 17th 2021, 18:11 |
alamnaryab |
also thanks to @kevin.pfeifer and @admad |
# |
Jun 17th 2021, 18:09 |
alamnaryab |
@ndm You are great Today in few hours I learnt too much I would like to be in your touch to learn more |
# |
Jun 17th 2021, 18:02 |
joey.mukherjee |
I have an entity which needs an array of other entities. I save them as a json_encoded string in the database. When I load them, I want to decode the string and create all the entities. Where is the right place to do that in CakePHP? Do I create a routine in the entity of what is saved or is there something that is called whenever I retrieve/find something in the table routines? |
# |
Jun 17th 2021, 16:14 |
ndm |
The easiest solution for you might be a redirect route (https://book.cakephp.org/4/en/development/routing.html#redirect-routing), given that you want to use use a fixed default language like in your middleware snippet, then it would just be a matter of something like `$routes->redirect('/', '/en');` |
# |
Jun 17th 2021, 16:06 |
admad |
If you know what you are doing, no; but since you are at this for days/weeks that doesn't seem to be case for you. |
# |
Jun 17th 2021, 16:04 |
alamnaryab |
@admad in this implementation I am not using that plugin will it be difficult to do it without plugin? |
# |
Jun 17th 2021, 15:57 |
admad |
https://github.com/admad/cakephp-i18n#i18nmiddleware |
# |
Jun 17th 2021, 15:52 |
alamnaryab |
what would be better event or method where I can put this redirect? app::beforeFilter()? |
# |
Jun 17th 2021, 15:50 |
ndm |
btw, if `/` would be the only route that would have no language parameter, then I would press even harder on implementing a redirect solution, eg redirect `/` to `/default-or-browser-language` |
# |
Jun 17th 2021, 15:49 |
ndm |
That example of course won't cover anything that you might want to in your app, you need to take a deep look at how routing works, otherwise you'll get stuck over and over again. You can connect `/` to whatever you want it to point to, like here in the first example https://book.cakephp.org/4/en/development/routing.html: `$routes->connect('/', ['controller' => 'Articles', 'action' => 'index']);` |
# |
Jun 17th 2021, 15:44 |
alamnaryab |
that routes.php is like electric wires for me :,( what should I add at which line of this code https://cakesf.slack.com/archives/C053DPNGT/p1623931730446100 |
# |
Jun 17th 2021, 15:41 |
ndm |
Yeah, the error happens earlier, as suspected, it's missing route error... eg there is no route connected for `/` (without language parameter). |
# |
Jun 17th 2021, 15:40 |
alamnaryab |
RoutingMiddleware is there but mine is not there named: DefaultlngMiddleware |
# |
Jun 17th 2021, 15:37 |
ndm |
You check the stacktrace. If you don't even reach the middleware, then I guess it's a missing route error. |