Welcome Guest, Not a member yet? Register   Sign In
Search Results
    Thread: Skip forEmptyDataset Exception if there no changes on update
Post: Skip forEmptyDataset Exception if there no changes...

Hi, I'm getting lost in this simple task ... During an update, I need to ignore the "nothing changed" exception.  Code: -- throw DataException::forEmptyDataset($type); -- I need to iterate a...
464 Views
1 Replies
12-28-2022, 08:16 AM
Jag81
    Thread: How to skip no data to update exception?
Post: RE: How to skip no data to update exception?

kenjis Wrote: (10-26-2022, 04:25 AM) -- try/catch. v4.3.0 will have allowEmptyInserts() method. -- Do you mean to leave the catch empty,  something like this? PHP Code: -- try{   $model->sa...
839 Views
2 Replies
10-26-2022, 06:20 AM
Jag81
    Thread: How to skip no data to update exception?
Post: How to skip no data to update exception?

Hi,  is there a way to skip the "no data to update" exception? I use this line to save: PHP Code: -- $model->save($entity); -- Often the entity is new, but sometimes the entity is known an...
839 Views
2 Replies
10-26-2022, 04:20 AM
Jag81
    Thread: Routes using param to chose which Controllers to use.
Post: Routes using param to chose which Controllers to u...

Hello,  I have the same method name for a group of controllers: PHP Code: -- public function get_html(){ } -- Intead of writing the complete route for every controller, is there a way ...
572 Views
1 Replies
10-25-2022, 02:40 AM
Jag81
    Thread: Custom Rule works in insert but fails in update
Post: RE: Custom Rule works in insert but fails in updat...

kenjis Wrote: (10-20-2022, 06:47 PM) -- Try to call cleanRules(false) before the update. See https://codeigniter4.github.io/CodeIgniter4/models/model.html#cleanvalidationrules -- GREAT! Solved...
1,340 Views
3 Replies
10-21-2022, 01:05 AM
Jag81
    Thread: Custom Rule works in insert but fails in update
Post: Custom Rule works in insert but fails in update

Hello,  I have written a custom rule to check if a "slug" is unique. The "slug" text field must be unique for a single tenant, so I have to check both parameters.  PHP Code: -- $data['tenant_id'] ...
1,340 Views
3 Replies
10-20-2022, 02:27 PM
Jag81
    Thread: API version fallback
Post: API version fallback

Hello everyone.  I'm thinking about how to do this: API version fallback.  I'd like to share my thoughts (and pseudo-code) to try to get how to do this in a good way (maybe some of you already mad...
560 Views
0 Replies
07-25-2022, 06:24 AM
Jag81
    Thread: How to clean Entity fields before saving
Post: RE: How to clean Entity fields before saving

kilishan Wrote: (12-19-2021, 08:55 PM) -- Do you have the $allowedFields filled out in the model with only the fields that can be updated? The model should take care of only allowing those fields thr...
4,135 Views
7 Replies
12-22-2021, 01:08 AM
Jag81
    Thread: How to clean Entity fields before saving
Post: RE: How to clean Entity fields before saving

I found a way that works for me and for my specific project, I have the code in a single point and I get what I want. I extended the Model class. I call my new model: StdModel. In the StdModel I h...
4,135 Views
7 Replies
12-16-2021, 07:46 AM
Jag81
    Thread: How to clean Entity fields before saving
Post: How to clean Entity fields before saving

Hello,  I find the Entity class very useful and I use them a lot, for every database table I have a Model and its Entity class.  What I find also useful is to get all the POST params from a form and...
4,135 Views
7 Replies
12-16-2021, 04:57 AM
Jag81
    Thread: Can't switch to production mode
Post: RE: Can't switch to production mode

Solved! I need to restart php spark serve
1,777 Views
2 Replies
12-14-2021, 10:04 AM
Jag81
    Thread: Can't switch to production mode
Post: Can't switch to production mode

Hi all,  I can't switch to production mode. I still have the CI_ENVIRONMENT variable set to development.  I use the.env file.  I changed the CI_ENVIRONMENT production line in the .env file (uncomm...
1,777 Views
2 Replies
12-14-2021, 09:48 AM
Jag81
    Thread: How to properly get the view as a string
Post: How to properly get the view as a string

Hi all,  My goal is to get a piece of (rendered) HTML code inside a JSON response.  Something like that: Code: -- { "status": "success", "html" : "Today is your birthday" } -- This is just ...
2,857 Views
2 Replies
12-14-2021, 07:16 AM
Jag81
    Thread: Using Session with a lot of AJAX
Post: Using Session with a lot of AJAX

Hello all,  I'm migrating an app from CI3 to CI4 and I take the chance to organize better the app.  I'm wondering about this part of the documentation:  Unless you’re developing a website with ...
3,389 Views
6 Replies
12-08-2021, 09:33 AM
Jag81

Theme © iAndrew 2016 - Forum software by © MyBB