I am new to propel,any one can explain me about what is the use of it and how to integrate any framework with propel?
Well, since there is an entire website about Propel, full of documentation and the like, I'll bet they can.
You bigger question, I think, is that you probably want to understand what the purpose of an ORM is. In short, it is a way of mapping between a relational database and an OOP framework, but Wikipedia has far more information, so you might want to start there.
EDIT
You mentioned in a comment that you'd like to combine this with CakePHP. Well here's how: don't unless you already know how to combine them. CakePHP has its own ORM system, so there really is no justifiable use case for having both (legacy code is not excuse -- just choose one!). If you're using Cake, use Cake and rejoice (you can have tea and skip on the or death)! If you're using Propel, use Propel and go somewhere.
For such a general question, I'd point you to the official site - http://www.propelorm.org/
Their documentation is surprisingly robust.
Have you tried their website? Here is a screenshot, this should do it. it's amazing what Google is capable of, don't be afraid to use it.
Related
I saw many many compares with php frameworks, but they are just rather general - OOP supported, MVC supported... there are really unique features which distinguish them. Symfony has flash variables, Zend has tons of classes for general purposes.
Anybody knows such compairing stuff?
Pick one you hear about, try it, and see what fits. Personally I've fallen for CodeIgniter, and just haven't looked into anything else as I haven't run into a limitation for my purposes.
Its really about picking the best tool for the job.
I'd say look into that table on Wikipedia that danp posted. I'd suggest doing some cursory research just by visiting the Wikipedia entries for a few of the top frameworks and pick one. The goal of a framework is to help the programmer to be more productive. If you have a good grasp of PHP and web programming in general, any of the frameworks will be a help.
If you are coming from a Rails background, I would suggest CakePHP or Lithium, since they share a tone of similarities with Rails. Hope this helps!
The problem with comparing unique features is that the unique features are mostly stuff you don't care about, otherwise it would already be implemented in the framework. I'd recommend you to go to forums, both people criticising it and raise it to the skies, see what their cases are and why their framework is a fit for them.
Don't just look for what a framework does, but what it does right.
I have been using ezSQL for the last few years but feel it is outdated. Though I like the simplicity and I like the file based caching ability with json, for small result sets that is.
So starting a new project I was looking for suggestions on a better mysql class for php. I know the db will only be mysql so portability is not a requirement. I read about mysqli extension, pdo etc but just dont know which one would be best for my situation. The site does a lot more reads than writes, though there are times where there are a lot of writes in the admin tool to the db. I looked at doctrine but dont know if that is too "bloated" for what I need. Hopefully this isnt to vague. Any suggestions?
EDIT
The site isnt small, I would consider it a high traffic site with a lot of db queries.
What don't you like about ezSQL? I often wish there was something like it for other protocols/languages I encounter. Every syntax should be written like ezSQL, in my opinion.. It describes the operation to be performed, in as few words as is possible, in the clearest and most logical order. Do you actually have performance problems, or are you just worried that something better has come along? I agree that ezSQL is rarely mentioned, but I have yet to find anything that matches it's simplicity, conciseness, and function...
From what I know of ezSQL (via it's wordpress pendant) I would consider Doctrine as well as too much for the moment because it's a complete data mapper for the database whereas you might be more looking to how to move away from your recent use of ezSQL which I think is a good idea.
Bascially you might be interested in a data-access abstraction layer. That could be PDO as it's build in into PHP. Even if you don't need to change the database server, it will give you defined interfaces how to query and access the data.
As you build the site from scratch, I can suggest you consider using some lightweight framework. A good introduction in my eyes is When Flat PHP meets Symfony which shows how a webapp can generally benefit from patterns and a flexible design.
From experience:
Doctrine - very easy to use I love doctrine query language - I never had to do initial setup though so im not sure how hard it is. It has very good community and lots of tutorials.
Propel - used for a bit. Does the job, very similar to doctrine. However, the documentation is very crap and community is very slack. I found that when I didn't know something it was quite hard to find an answer and often I had to post on Google forums.
Note: If you are starting from scratch you might want to look at some of the frameworks such as symfony+doctrine is a good combination, makes development a lot easier.
Links:
- http://www.doctrine-project.org/
- http://www.propelorm.org/
Something easy like CI (this means mandatory good, easy, up to date documentation). But also with some more features than CI.
Yii has lots of features, but it is also more complex (and it kind of forces you to have to use lots of it features). That means adding some functionality to your web-app takes three times as long because you have to figure out lots of new small functionalities of Yii.
It's kind of like the CI "gets out of your way" when it needs to, and Yii gets in your way, and if you don't do it its way, it breaks.
Features missing in CI that would be nice to have in this new "intermediate" PHP framework:
Code generation (crud).
Authentication.
Access control.
Layouts.
Widgets.
Easyer / automated pagination (like yii)
easy uri parameters
Where Yii causes me problems:
It's like for every small task there is some inbuilt functionality (this is good), but, YOU HAVE to use the inbuilt functionality, otherwise bad things happen. (CI gets out of your way, but does it too much, Yii helps a lot, but is butting in too much at times, and it forces you to sift through its documentation so that you discover these functions without which you are not able to accomplish a task that would take four time less, in CI, or in a non framework app).
Is there something in between ?
(ASP.NET MVC could be 'it', but I don't know the language, so the effort to learn it would be greater than learning Yii php framework really well, so I am looking for a PHP Framework)
I am a fan of CakePHP. I feel it has the specs you provided. If you want something more cutting edge you can take a look at Lithium
I have found some resources that kindof solve the problem, because they contain examples (Milan Babuškov's sugestion helped focus on "the solution").
Yii playground - examples
Yii cookbook - examples
Yii blog tutorial - more examples
PS. there is also google - I find solution (and examples) the fastest this way - ex: implement + pagination + yii
I've used both CI and Yii (on my own projects if that makes any difference). CI was my first introduction to MVC, and I found it easy going because it let me use any crappy structure and code. I wrote two full sites in CI (www.insolvencynews.com and www.thebigeat.com if you want to see complexity.)
I had a look at CakePHP but got NOWHERE.
Then I moved on to Yii and, like you, I found it pretty tough and rigid. But I then found that it was so powerful and extensible that I was so much more efficient. When I needed to add a few new features to the old CI sites, it was faster to rewrite the entire sites on Yii than to code up the extra features in CI.
I can't recommend a framework in the middle, but I can recommend sticking with Yii. When you say Yii gets in the way, can you give an example? Looking at DB stuff (in ascending order of dependence on Yii):
you can code using PHP's core MySQL functions.
$result = mysql_query($sql);
you can use Yii's DB abstraction layer.
Yii::app()->db->createCommand($sql)->queryAll();
You can use Yii's ActiveRecord:
Takeaway::model()->findAll();
you could try kohana (especially coming from ci)
You should check out the CI community, some of those extensions maybe have been written by someone else (I remember seeing Authentication and Components/Widgets somewhere)
Symfony is worth checking out. I personally don't like it much because they chose Prototype over jQuery for their ajax features, which is really annoying to use when you're used to jQuery.
Lithium might be good to check out too. However, it is php 5.3 only and you need to be really careful that this version of PHP is going to be supported on the server the site will be deployed on.
See this list for good comparisson:
http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#PHP_2
From a personal point of view, I would go with symfony because of it's
rich features and
great integration with many other already bundeled components (Doctrine, Swift Mailer,..),
good (but at first complex) code generation that produces realy useable code to get you startet quickly,
powerfull use of templating (that will be the point you mention under "layouts)
many different, powerfull plug-ins, including Authentication & Access Control (it also has a plug-in to get jQuery support)
one of the best tutorials that I've seen with a framework
Downside is a
more complex structure,
IMO wired file structure,
a rather messy API documentaion compared to the tutorial
CodeIgniter is a nice framework if you don't want to create big apps but it lacks a great database integretaion and you already mentioned code generation.
im very good in Raw PHP, where the project at hand became too much to handle i decided to move to zend, with too too much complexity i finally moved to YII which really reduced the cost and overhead time for project development and most importantly for me is the simple integration of jquery, widget and advanced-OOP.
You could have a look at Qcodo / Qcubed.
They are both easy to pick up and offer code generation / ORM
Easy way to create forms in an mvc kind of way.
For what its worth, if you're looking for a PHP Framework that is like ASP.NET MVC then I think Prado is the closest thing you will find.
Basic ORM strategy in PHP: How could it look like?
Without wishing to cause offense, I’d suggest that you scale this back quite a bit - you seem to be biting off a lot more than you can chew considering your familiarly with the language and general OO practices. (I'm basing this on some other questions you've asked - not just this one.)
As an general suggestion, I think you'd save yourself a lot of pain by having a thorough read up on object orientation in general (design patterns couldn't hurt as well) and then thinking about the problem afresh.
Alternatively, if you post the problem you’re trying to solve (rather than discussing issues with a solution you’ve decided upon) you might get more traction.
Hope this helps.
I think you should look at existing PHP ORMs for an example:
Doctrine
Propel
Outlet
Sprig (Currently in development by the author of the Kohana framework)
Those are the main ORMs people use, listed in order of popularity.
I have found this tutorial online
http://net.tutsplus.com/tutorials/php/creating-a-php5-framework-part-1/
I have created myself a simple sort of framework, but I have not been too knowledgeable whether I have followed best practices and the like... which I really would like to do.
I am looking at making my framework more unified by the MVC pattern. It seems I have sort of followed the principles, but I won't be happy until I can say my framework follows the design verbatim (and can, when it needs to be, easily picked up by another developer).
My question is, is this tutorial online a good place to start? I am using PHP5 with Apache.
Please note, I am not looking for the 'Why reinvent the wheel' type of answers, I'm doing this for fun and as a learning experience.
Alex, I must say I haven't read the article and please don't take this the wrong way, but I think the best way to learn about shortcomings of your own framework or to find out if it meets certain standards is to open it up - make it open source - and let other developers take part in it. They will be pretty quick to complain or point out flaws.
Even if your only goal in creating this framework is to learn, I think you can benefit from a code review. And what better way to get a code review than by inviting other people to join you in your "quest".
This way you should also have the chance to challenge the others code and maybe ask questions to find out why they write code a certain way.
I hope you'll find this at least a little bit helpful ;)
P.s. I'm going to take a look at that link now..
I haven't read the article you referenced, but one way to find out if your framework is useful is to try using it in a different way than we did before.
You may want to experiment with when to use classes in PHP and when not to, as it isn't one size fits all.
You may want to try to not have your business logic tied up in the same php file as your html, but keep them separate if you want to follow good MVC practices.
Good luck. :)