Skip to content

CI4: OSPOS Function signatures not compatible with CI4 #3602

Closed

Description

@objecttothis

With CI4 comes a number of built in CRUD functions by the same name as some of our model functions. The problem is that the function signatures do not match, so it throws a runtime exception.
image

This can be resolved one of two ways

  1. Rename functions so they are no longer inheriting their base function. This involves refactoring but potentially less in terms of code rewrite.
  2. Keep function names but rework signatures and functions to match their base functions.
  3. A hybrid of 1 and 2. Rework the low hanging fruit (easy ones), rename the more complicated ones and create a technical debt to go back and rework the renamed functions after the CI4 upgrade has been merged into the master.

No one likes code that looks like a rat's nest, so I prefer 2, but unless more people are able to contribute to this upgrade, we may need to compromise by doing 3. @jekkos @daN4cat @opensourcepos/org thoughts?

closed by #3592

Activity

  1. added this to the 3.4.0 milestone on Nov 28, 2022
  2. self-assigned this
    on Nov 28, 2022
  3. linked a pull request that will close this issueFeature: CodeIgniter 4 upgrade #3592on Nov 28, 2022
  4. jekkos commented on Nov 29, 2022

    @jekkos
    Member

    What does the base function exactly do? If its internal kitchen then we perhaps better change the signatures. I agree that we should strive to make changes consistent.

  5. objecttothis commented on Nov 29, 2022

    @objecttothis
    MemberAuthor

    https://codeigniter.com/user_guide/models/model.html#deleting-data

    They are cookie-cutter CRUD functions meant for use in the application. In many cases I think we may be unnecessarily overriding them because CI4 provides the functionality we want. For example we can do $attribute->where('attribute_id', $attribute_id)->delete(); and no need to override. The only caveat with delete specifically is that we want soft deletes. The way CI_4 does this is with a $useSoftDeletes boolean in the model set to true and a datetime field in the table called deleted_at then the base function will populate the field with the current datetime. I think this is a more elegant solution than our current deleted flag because it not only tells you that it is soft deleted but it tells you when this was done. You can still hard delete the value by adding true into the 2nd parameter of the delete function. That said, perhaps we consider refactoring and database changes associated as a separate changeset and just simply override the functions or rename then set a technical debt to implement CI4 style delete in the code. I'm pretty sure the create, read and update functions don't need much in the way of refactoring like delete would.

  6. removed their assignment
    on Dec 1, 2022
  7. changed the title [-]OSPOS Function signatures not compatible with CI4[/-] [+]CI4: OSPOS Function signatures not compatible with CI4[/+] on Dec 9, 2022
  8. objecttothis commented on Feb 18, 2023

    @objecttothis
    MemberAuthor

    I believe I resolved all of these. Will reopen if I find more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions