Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7574725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:30:21+00:00 2026-05-30T16:30:21+00:00

Whats the best practice in overriding methods? Especially if we need to add another

  • 0

Whats the best practice in overriding methods?
Especially if we need to add another param?

This is not E_STRICT compliant (adding $soft as second param):

public function delete($id, $soft = false, $cascade = true) {
    if ($soft) {
        return $this->_softDelete();
    }
    return parent::delete($id, $cascade);
}

Resulting in:

Declaration of Conversation::delete() should be compatible with that of Model::delete()

I know that one shoudn’t override methods this way (adding-parameters-to-overriden-method-e-strict-observation).

but If one has to, how would one proceed? (without having to remove E_STRICT)
The basic idea was to intercept the normal delete calls without having to rewrite all occurrences of this model method call.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:30:22+00:00Added an answer on May 30, 2026 at 4:30 pm

    It’s either E_STRICT compatibility, or modyfing function signatures. You can’t have both.

    The solution is usually to use composition instead of inheritance, that is to wrap the object which behaviout you’d like to modify within a new class with different signatures.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats the best practice for getting a commenter's email address from the cookie (this
Whats the best practice to avoid hardcoding links in iOS apps? I need to
Whats the best practice for setting up package structures in a Java Web Application?
Whats the best practice approach to creating a form that is used to both
Whats the best practice for implementing a confirmation page in .Net? I've used response.redirect(Thankyou.aspx)
I'm faced with the following and I'm not sure what's best practice. Consider the
for some days me and my colleague are discussing whats the best practice for
whats the best practice to end a tcp message? I now have my own
Whats the best practice for Asynchronous Oracle Connectivity in .NET specifically C#. Ideally something
I was wondering, whats the best practice on the example below. <?php if(isset($_POST['query'])){ $out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.