Upgrade CakePHP from 2.1 to 2.8+ - cakephp

I'm sure I should upgrade my project from 2.1 to 2.8+
But how hard would it be? Anyone have some experience like this?
Are there any "dos and don'ts" I should know (apart those from the man)?

But how hard would it be? Anyone have some experience like this?
How hard it is depends on the quality of your code and how close you stayed to the principles of the framework. If you used it well and followed its conventions and didn't change core classes or made any other big stupid thing it should be just a matter of following the migration guides.
Are there any "dos and don'ts" I should know (apart those from the man)?
No, just follow the migration guides. Every version has one that describes the changes. Here is the one for 2.8, I'm sure you'll be able to find the others.
http://book.cakephp.org/2.0/en/appendices/2-8-migration-guide.html

Related

Best way to upgrade a Cakephp project from Cakephp 2.6.2 to 3.8

I have been tasked with upgrading a legacy system from Cakephp2.6.2 to Cakephp3.8. Obviously the 2 are drastically different but is there a simple way of getting the old project to work with the new cake version? Or could anyone steer me in the right direction for the best way to do this?
There is no generic "best way" that fits all. The best way is the easiest way for your specific application that results in a properly working application, but that's something that you need to determine for yourself.
There's an upgrade tool that can automate some of the repetitive stuff, like changing directory structures, renaming classes, adding namespaces, etc, but in 99.999999% of all cases the result will not be a working application, you'll still have lots of manual migration to do. How much that is, and how complicated it might be, totally depends on your application, it might be rather simple, but it can also be so complicated that rewriting from scratch might be the better choice.
IMHO you should first make yourself familiar with CakePHP 3.x, to the point where you are able to confidently create robust applications. Lots of questions that you may have about upgrading will solve themselves once you are familiar with CakePHP 3.x.
You should not directly upgrade from Cakephp 2.x.x to Cakeph 3.x.x, here are reasons,
Code base and directory structure is entirely different and it will not work properly.
If you have not good grip on both version trails then you will find yourself in trouble.
Best way in your case, you should upgrade to some higher version of cakephp 2.x not jump to cakephp 3.x. If you want to switch to cakephp 3.x you should rebuild app from scratch.

Agile Toolkit, worth using?

I'm considering using the Agile Toolkit, ATK4 to upgrade a number of web projects that I'm working on. I really like the idea/paradigm that the Agile Toolkit presents, but I'm worried about documentation.
The agile website's documentation is sparse, in broken English, and seems to 'paraphrase' the symfony documentation.
The agile toolkit alleges to have been in development/production since 1999, yet there are only a handful of StackOverflow.com posts regarding agile, and next to nothing comes up in Google searches...
In short is it worth spending time learning the Agile toolkit, or would my time be better spent on a framework that has more of an active support community? I've tried a few other frameworks, but ATK's implementation really stands out...
Initially ATK was born as an internal tool from Agile Technologies (.ie) so that has been conceived in 1999 but it was recently launched as dual licensed framework.
That's why it lacks some documentation and has not a huge community nor appears Googling.
I was amazed at first sight by its working way proposal so that I engaged it. The documentation has been already improved and over the time it will keep getting better and community will grow.
I had the chance to get in touch with the lead developer and trust me, it will get better and better.
Even, as an example all the ATK4's site is developed with the toolkit and the code is short and pretty easy to read.
Good luck!
ATK4 does have many examples, and code is concise and clear. It accomplishes the goal of wrapping server-side and client-side into one comprehensive framework via php. Plus it looks nice. It does appear that documentation is improving.
Yep - agree with what the others are saying - Romans is doing a great job of getting the documentation updated. I started writing an application in straight php but realised i was going to need to use jquery to get a nice, cross browser compatible front end and wanted a php framework that would support that.
I looked at Yii, Cake and CodeIgniter but ATK4 really seems to do what i wanted. Like anything, it takes a bit of getting used to and i'm still relatively new to both php and ATK4 but i've rewritten what i already had for my application in the framework and the code is so clean - all the html and css are separate and the page code is really compact. The integration with Jquery is great and i've just written a plugin that i needed to get jqplot working for nice looking graphs.

What database options do I have for the Blackberry?

I notice most of the discussions about Blackberry database options are old, and generally not too informative.
As of today, March 31st, 2010, what is the best, most universally supported, free database option available for Blackberry developers?
I heard SQLite is available for JDE v5, but last I checked, that was still in beta, and I didn't want to commit to developing on a system that is not supported by most of the phones in service.
Thing is, I don't see any dates on these claims. For all I know, the announcements I am reading are from 2008.
So, I am still on v 4.7. I need to use a relational DB for the app I am developing, but there aren't many resources for DB handling available - or at least resources that are useful to me. I find a lot of "tutorials" that assume you know everything there is to know about Blackberry development, or Java. But no complete classes or anything. Many of these examples don't even work. Eclipse gives warnings and errors from code copied and pasted from other people's examples.
I can answer any questions that may assist in this case. Hopefully, this thread will help many BB developers in the future.
Before v5 I don't think there is a native relational database that you can work with on the Blackberry, the closest thing is the Persistant Store API, however I think that there are 3rd party libraries that you can use, like SQL Anywhere.
Depending on the Java dialect supported on your Blackberry version, db4o could also work well for your usecase. It's an object database, quite similar to Perst.
Ok, in case anyone has had similar experiences with this, here is what I have done:
The JAR class path thing was resolved through no help at all from these sites.
What I did to get an outside JAR included in my package was to right click the package name in the navigation menu (Eclipse) - then select Build Path - then add libraries.
From this I was able to modify an existing library to include the JAR for the perst package.
Now I am able to import org.garret.perst.*
We'll see if there are any complications.
Forgive the number of posts, maybe it will help someone else down the way.

What is better CakePHP or pure PHP for a huge Project?

I just know pure PHP, never worked with a framework before, but my boss wants me to create our next project, which will be a lot bigger than everything we did before (means bigger than a page that needs only 5 scripts to work, more like 100 or something like that).
But I'm not sure if I can realise it with pure PHP, now I heard that CakePHP could be helpful for that (structure etc.).
Should I learn this or just use my pure PHP way?
As noted, your definition of the scope and complexity of this project is a little vague, but I'll respond with the general observation that larger projects benefit from more "top-down" structure than smaller ones. I suspect that pretty much every PHP developer on the planet started by hacking straight into index.php, then wrote some code for guestbook.php, and so on. Then you realise how much you're repeating yourself and start refactoring to classes and libraries.
Frameworks are the natural next step up from that. The term covers quite a range of products; some that tie you very closely to a specific way of working, and some that are more a library with some loose front control.
I'd advise you to choose a loose MVC framework, which gives you a good structure to work within, but doesn't overly constrain you, and should allow you to use existing libraries. I've not used CakePHP - my experience is with Zend Framework, which I like a lot (not that it's flawless). However, I have worked with another developer to compare the functionality of Cake and ZF, and from what I've seen Cake has many of the strong points that ZF displays. In fact, in many places it almost seems you could convert code from one to another by changing a few classnames.
I suspect Cake's not a bad choice at all, but I can't recommend it as I don't know enough about it. ZF I do know, pretty well now, so I can recommend it - and the docs are now pretty good.
Before you dive into either Cake or ZF, you'll need some understanding of the MVC design pattern. Jason Sweat's book is a good, if slightly dated introduction, and the ZF manual is also pretty strong.
By the way, it's not a choice between "Cake and Pure PHP". Cake (and ZF) are both "Pure PHP". The difference is between "PHP I wrote", and "PHP someone else wrote" (so I didn't have to). From this, the important bit is that you trust the quality of that "someone else's code", which in this case you'll have to do by recommendation and reputation.
But don't just go asking "What's the best PHP framework?" - that's like asking for the best text editor ;) And I'm sure this response (or question) will get tagged 'subjective' in mere moments.
I've been using Cake for a couple of years. I'd say if you haven't used any MVC framework before, you should definitely learn one to expand your horizon.
It's not really about using the framework for your convenience. It's about seeing how things are done in the framework-land. You'd really gain some insights that you can carry over even if you later decide not to use a framework.
Your description of the project didn't sound too huge. However, learning an MVC framework is some serious learning curve there. Basically you'll feel like you're learning a whole new programming language. So for your situation if you really do decide to try a framework, you might want to factor that in your schedule.
To get you started, I personally think CakePHP has a more elegant solution and has tighter design philosophies. CodeIgniter, on the other hand, seems more natural to "pure PHP-ist" because it's less abstract so it might be easier to pick up.
To answer the titled question though, I'd think any huge project should roll their own from the start instead of using a framework. The whole point of using a framework is because you want to leverage some of the stuffs they have built in for you. But for really huge projects, many of the parts should be customized anyway, so you might found yourself restricted by the framework more than leveraging it.
But then again, I really don't think your project (by your description) is anything near huge. As a ballpark estimate I'd say any project under 50k - 100k hits a day can safely benefit from using a framework.
I do not say CakePHP. But any framework will do. The major benifit will be you will get a default folder structure, skin, language framework (oscommerce etc. do). You will be customizing this framework. Most features will/may there be by default, like email sending, page creation, Menu generation etc.
You did not say what kind of application you plan (may be because of NDA). More details, more accurate answers.
I agree that it shouldn't be a decision whether to use CakePHP, but whether to use a framework at all. There are a multitude of PHP frameworks out there (Cake, Symfony, Codeigniter, Zend, etc.) and each has it's advantages and disadvantages.
If it was me, I'd use a framework just to strictly enforce some MVC rules... with a large project, keeping things structured helps down the road when someone else inherits the system.
The key here, is don't get lulled in by the "code generation" aspects. If you don't know the framework (or don't know the language as well as you could) down the road, the code generation could be more of a headache than it's worth.
Using a PHP framework like cakephp will reduce the amount of code you need to write. In cakephp there are many things that will save time like using elements to display snippets of code that you use often. If the project is really big, it will help tremendously because your code will be shorter and much more clean and organized. It will be much more easy to maintain as well.
I think that pure php would be the best option because if you use a framework you are restricted to their boundaries,
whereas without framework you are free to design anything, if you think that you have the best capability of solving problems and making algorithms then you must go with php not any kind of framework
and if you just want work to be done then you must go with framework i haven't worked on framework by have some knowledge of cake php i didn't liked it as i think i am tied with some rules, i prefer writing my own code and in case you want to do less work in future just write you own rules (its like making your own framework) just save every thing you created in small files and then use them in you other project just like one of the benefit of OOP(Object Oriented Programing)
If you know PHP, you'll learn more about how to implement common design patters if you start reading other peoples code. The more you read, the more you'll get perspective on what good code looks like, and what bad code looks like.
It is tempting to "code-your-own" because you will understand it more fully, but remember, you're not going to be the only one working on this, and one day, you might actually want to work on something else, and having a system which is widely implemented and understood can make it easier to move on.
As far as whether cakePHP a good choice for your particular project, it's hard to say without knowing more than it's going to be "bigger".
Everything depends on the project and the project stake holder. If there is going to be a lot of modification, either during development or after the project goes live, a framework can be pretty limiting to someone without a strong grasp of the theories behind the framework (not a judgement on the programmer, just a statement.)

Good facelets resources?

I've been working with JSF for some time, and been using the Apache-Trinidad tags. I like developing using this a lot but I keep hearing great things about facelets. Is anyone out there using it, and what exactly does it get you?
I've looked at the facelets site (https://facelets.dev.java.net/), but it doesn't do a very good job explaining the advantages or any tutorials about facelets. I looked on google, but everything seems to be from 2005 or 2006, surely there's been a lot of changes since then.
Anyone want to chime in with their opinion of facelets or point me to some good resources?
Facelets haven't really changed. It's a very simple templating engine that runs as a JSF view handler and replaces jsp.
The old resources are still valid.
Uses xml for templates.
You can use EL anywhere.
Very few tags.
Very simple
...
In my humble opinion, it is a much better approach to create the interface than JSPs.
It's really a great thing about facelets. They did it right the first time, so I guess theree has been no need to upgrade it. Also seems like something like facelets is making it's way into the JSF 2.0 spec. (http://jcp.org/en/jsr/detail?id=314)
At one of the places I work, I've just converted a project from JSF 1.1 to JSF 1.2 with facelets, and I really like it. What I got from it was:
Templating (no need for tiles)
Better debugging (debug views instead of just stack traces)
ui:repeat and c:if etc
Can use html intermixed with tags, allowing me to use a plain html table with colspans without no extra taglib if thats what I want.
syntax almost same as jsp, so it's easy to convert pages.
rolling your own components is now really simple.
As for resources, I guess the old ones are still valid.
I've just started working with facelets as well, and so far the best resource I've found is the book "The Definitive Guide to Apache MyFaces and Facelets" from Apress. While it's likely you won't need the other chapters, since you've worked with Trinadad tags already, I've found the examples they use to explain facelets give a good concrete foundation. I'm constantly refering to the text to pull out bits of code.
PS Here's the link from Google Books, it'll at least give you a taste of what's inside.

Resources