Welcome Guest, Not a member yet? Register   Sign In
Search Results
    Thread: What is the best practice for querying a DB with 2 or 3 tables
Post: What is the best practice for querying a DB with 2...

I have 3 tables: BlogTable BlogTagTable - Record one row for each tag in a blog post. Eg. if 3 tags, will be three lines in the db with reference to the tagId and BlogId. TagTable - master li...
347 Views
2 Replies
06-12-2024, 07:17 PM
spreaderman
    Thread: Should relationships be set in the DB or rely on code?
Post: RE: Should relationships be set in the DB or rely ...

Many thanks for all the input. It is very clear. Don't rely purely on the code.
275 Views
3 Replies
06-10-2024, 05:09 PM
spreaderman
    Thread: Should relationships be set in the DB or rely on code?
Post: Should relationships be set in the DB or rely on c...

I am using mysql.  I can optionally add hard coded relationships between tables in mysql by use of foreign key and make it cascade or restrictive for example.  My question is, design wise, would it be...
275 Views
3 Replies
06-10-2024, 04:01 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

Thank you Kenjis. It now works. Something like this right? It now saves on new data, updates and doesnt do anthing if the record is not changed. PHP Code: -- foreach ($aa_winter_sports_...
1,749 Views
24 Replies
06-07-2024, 09:48 PM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

kenjis Wrote: (06-07-2024, 07:39 PM) -- It seems you misunderstand something. PHP Code: -- $QgisResort = $this->QgisSkiResortModel->find($new_fill['id']); -- The Model::find() method returns nu...
1,749 Views
24 Replies
06-07-2024, 07:51 PM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

kenjis Wrote: (06-07-2024, 06:51 PM) -- Read the error message carefully. "Call to a member function fill() on null" That is, $QgisResort is null. -- Thank you Kenjis. It is my lack of understan...
1,749 Views
24 Replies
06-07-2024, 07:27 PM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

Thank you for all the pointer thus far! Really appreciated. Really having a hard time understanding entities. I still get an error Call to a member function fill() PHP Code: -- use App\Models\...
1,749 Views
24 Replies
06-07-2024, 04:02 PM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

Maybe I am not understanding ENTITIES properly? The model is setup to returntype ENTITY. In my controller, do I need to load both the ENTITY and the MODEL? I am kind of confused as to when I ...
1,749 Views
24 Replies
06-04-2024, 04:01 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

ozornick Wrote: (06-03-2024, 12:09 AM) -- Why double fill() ?  PHP Code: -- $this->OsmSkiResortModel->save($OsmSkiResort->fill($new_fill)); -- -- Thanks @ozornick. I can change that but it still f...
1,749 Views
24 Replies
06-04-2024, 01:22 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

I thought it was working but not so. I am getting the following error: Error Call to a member function fill() on null It is related to: APPPATH/Controllers/Admin/Ski/Ski_Controller.php at line 312...
1,749 Views
24 Replies
06-02-2024, 03:43 AM
spreaderman
    Thread: hasChanged() says it has changed when it hasn't.
Post: RE: hasChanged() says it has changed when it hasn'...

ozornick Wrote: (05-28-2024, 08:14 PM) -- There is little data to answer.  Show what you have before the change, what you are changing for. You can compare these two lines as var_dump(A === B) -- ...
206 Views
2 Replies
05-30-2024, 03:44 AM
spreaderman
    Thread: hasChanged() says it has changed when it hasn't.
Post: hasChanged() says it has changed when it hasn't.

I am using entities. I am checking to see if the new post data has changed when compared to the database. I have about 223 records. I have tested my code and everthing works, however, for one recor...
206 Views
2 Replies
05-28-2024, 05:41 PM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

spreaderman Wrote: (05-28-2024, 04:16 AM) -- ozornick Wrote: (05-27-2024, 11:16 AM) -- You can change the fill() method by filtering the array_filter() array of $data and allowing only $attributes f...
1,749 Views
24 Replies
05-28-2024, 05:18 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

ozornick Wrote: (05-27-2024, 11:16 AM) -- You can change the fill() method by filtering the array_filter() array of $data and allowing only $attributes from the model -- Many thanks. I did not kno...
1,749 Views
24 Replies
05-28-2024, 04:16 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

I think I figured it out. Indeed the data and the new data were different and hasChanged() was of course correct. I have 25 fields in the databases. Sometimes the input data is 28 fields (some ne...
1,749 Views
24 Replies
05-27-2024, 03:49 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

kenjis Wrote: (05-26-2024, 05:53 PM) -- spreaderman Wrote: (05-26-2024, 02:12 AM) -- In line 3 below, I used find() and it returns a $category entity.  Is line 3 required in order for line 5 to work...
1,749 Views
24 Replies
05-26-2024, 09:12 PM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

kenjis Wrote: (05-25-2024, 10:53 PM) -- Read https://codeigniter.com/user_guide/models/entities.html#checking-for-changed-attributes -- Thank you Kenjis. I previously read that. The below code wor...
1,749 Views
24 Replies
05-26-2024, 02:12 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: RE: How to understand entities, save, hasChanged

spreaderman Wrote: (05-25-2024, 08:27 PM) -- I have using entities and having a bit of trouble understanding them.  I am importing ski resort data from a geojson file.  All of the 300 ski resorts imp...
1,749 Views
24 Replies
05-26-2024, 12:44 AM
spreaderman
    Thread: How to understand entities, save, hasChanged
Post: How to understand entities, save, hasChanged

I have using entities and having a bit of trouble understanding them. I am importing ski resort data from a geojson file. All of the 300 ski resorts imported nicely. Now I am testing if there is an...
1,749 Views
24 Replies
05-25-2024, 08:27 PM
spreaderman
    Thread: $this->responseCreated() method not found
Post: $this->responseCreated() method not found

I was listening this to tutorial about shield and api: https://www.youtube.com/watch?v=0sdbsbOW8wA&list=PLT9miexWCpPW6Z_OXNv2d78cqCrZaPrVG&index=31 At 10:05 the author uses $this->respondCreated()...
289 Views
2 Replies
05-18-2024, 05:42 AM
spreaderman

Theme © iAndrew 2016 - Forum software by © MyBB