Reputation: 834
Note before we start: I've asked this question on the Phalcon forum as well as here to try and broadcast the question a bit wider.
Following on from a question on the Phalcon discussion board by jasmad...
I am in the process of migrating an application from CodeIgniter to Phalcon, and I'm looking with eagle eyes (pun intended) at the models, which to me seem the easiest place to start (as well as having the biggest performance improvement for my project).
Are there any kind of tutorials/guides to migrating models from CodeIgniter to Phalcon knocking about? Has anybody got experience in doing this that they'd mind sharing?
I've got a shedload of queries that look like:
$this->db->select("a.*")
->from("tableA a")
->some
->other
->conditions;
$this->b_model->join($this->db, "a.idB")
and b_model might have a fn like this:
function join (&$db, $col) {
$db->join("tableB b", $col . " = b.id", "left");
->select ("b.*");
}
Those are much simplified versions I've just typed up for conciseness, but hopefully it'll give an idea what I'm trying to achieve.
Just as a note, I don't want to use the in-built Phalcon relationship doodahs for reasons that are longwinded and will detract from the focus of the post. I just want to change those queries in to a PHQL query builder thing, also utilising some existing libraries & helpers that the CodeIgniter models use.
Anyway, yeah, is there some kind of guide for folk wanting to migrate? I don't mind writing up my experiences if there isn't, but it's always nice to have a guiding hand from someone who's done it before ... :)
Upvotes: 2
Views: 269
Reputation: 26423
model manager is one of service in phalcon, so you can add your model manager to dependency injector taken from cakephp and have all your old queries working fine. Of course, if you want to use phalcon's models, i wonder if you would be good to go without changing your code.
Upvotes: 1