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

  • Home
  • SEARCH
  • 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 6810435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:12:19+00:00 2026-05-26T20:12:19+00:00

As part of a university project I’m developing a web application in PHP and

  • 0

As part of a university project I’m developing a web application in PHP and trying to follow MVC principles as much as possible. I’m not using an off-the-shelf framework because I want as much of the project to be my work as possible to help get a higher mark.

To delete an item (each item has an id, status, title, parent_id) from a database I go do the following process….

  • User hits a delete button and is asked to confirm
  • When clicking confirmed a “page” loads which calls the controller, initiates a model which is stored in the controller object
  • A method in the model object is called to load the item from the database based on the ID in the URL
  • I edit a status property in the model to mark the item as deleted
  • I then save the model to the database which in effect deletes it.

I also want to delete all child items in the database of the item that has just been deleted. Where is the best place to do this? In the the controller? In a separate functions file? In a model file?

I’m pretty new to the whole MVC idea, so any help / advice is much appreciated.

  • 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-26T20:12:19+00:00Added an answer on May 26, 2026 at 8:12 pm

    The basic breakdown of MVC is

    • Model: Business logic
    • View: Presentation logic
    • Controller: Glue logic (triggers model functionality based on user input, render views based on model output).

    The statement “Deleting an item will cause all its children to also be deleted” is a description of something that needs to happen in the business logic. Therefore, it belongs in the model.

    Implementation is up to how you have implemented getting child items and deleting items in your model, but it will typically consist of getting a collection of your model’s children in its delete method, and invoking the delete method for each child in the collection (each child will also look for children and delete them when this happens). Now the view and controller don’t have to worry about whether or not a model has children, as it’s all taken care of in the model’s business logic.

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

Sidebar

Related Questions

I'm building a game level editing app as part of a university project. In
As a part of my final year university project I am designing a social
As part of a university project I have to do some signal processing and
As part of a university project, we have to write a compiler for a
As part of a group project at University we've hit a bit of a
I'm trying to develop a web app for a university who's looking to keep
I am developing a Java SE based application (university intranet) for a computer security
Part I I am working on a web application that instead of using a
Learning C at University. This is not a homework, but I was trying to
My university is part of MSDNAA, so I downloaded it a while back, but

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.