1

I got an old running project that was developed with HTML, CSS, PHP, MySQL, JS, AJAX (jQuery) but without MVC, ORM, etc. Just HTML/CSS/JS and PHP is seperated. I am currently working on this project and do some improvements of the sotware from time to time. Since the system is in use every day, I want to introduce CakePHP module by module and improve the quality step by step.

Having MVC, ORM, etc. would make maintaining more efficient but I don't have the time to rewrite everything at once. I don't think there won't be many problems except the login procedure (make sure that when you log in using the routine of CakePHP that the user is logged in while using modules of the old system) and linking of the files.

What do you think about it? Are there more obstacles?

2 Answers 2

3

I don't envy you :-(

You could just drop the whole of the existing web app into /app/webroot and it should run from there and then gradually 'cakeify' sections by creating controllers and views, but tbh, this project should either be a) 'scrap it and do it properly' or b) 'it works as it, just maintain it'

If it were me, I'd go with option b) or try to convince the powers that be that it should be re-written from the ground up.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for being honest. I thought about the same: dropping everything in /app/webroot/ and then making a complete MVC-concept at once but implementing it step by step - this should be pretty much the same as rewriting it from the ground. Don't you think so?
Yes, but I'd keep both code bases completely separate. Keep the existing system separate and live (while updating it with the new features) and start afresh on a new codebase using the live site as a template.
1

Well... If you already have application (that is not MVC) and you want to convert it to CakePHP, you will have to think about some things...

1.) As you've sad, Logging users will be a problem but there is AuthComponent.

2.) You will have to think differently about some things because this is MVC.

3.) All your validations should be in Model.

4.) Granting access to some pages will be done with isAuthorized function from AuthComponent.

I think the best way for you is to download a fresh CakePHP and start with models. Do all your validations. Then create controllers and some of code which is "global" put in Components.

Then do your view.

Well... Use Bake script and it will be easier a lot. If you have any further questions or if you need help, feel free to ask here or send me an e - mail (provided on my profile).

I think that converting PHP app to MVC (CakePHP) is a really great idea. It is much easier for changing later, adding some functionality and debugging. :)

Good luck!

1 Comment

Thanks for sharing your tips! Since I have already worked with CakePHP in the past, this shouldn't be too difficult. Maybe I'll read a book about the details of CakePHP because the project is soo huge that I can use every advice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.