NYCPHP Meetup

NYPHP.org

[nycphp-talk] CakePHP Making a Model return data from a different database.

Edward Potter edwardpotter at gmail.com
Tue Nov 23 14:37:15 EST 2010


<rant>

In the end, I canned all the frameworks. And built my own.

They are just so, so, so overkill. IMHO.

But I digress, and I am not helping you at all. But there is a big Cake user
group off the main site, probably a quick answer there.

MVC sounds SO great in academic circles, but in the end, sometimes you have
to break the rules. The M is cool, the C is cool. But the V is where you can
break it out. I call that the P, for Presentation Layer.

Is php really a good candidate for MVC?  Sometime I'm not 100% sold on that
idea. But that does not diminish at all what you can do with it. Actually it
may make it much more versatile ---- because you can break the rules.

</rant>

:-)

On Tue, Nov 23, 2010 at 1:54 PM, Bruce Martin <bmartin at mac.com> wrote:

> Hi all,
> I am assuming there are people on the list who are knowledgeable about
> cakePHP on this list. I'm still trying to wrap my head around it and so far
> I'm finding it a bit tricky. I'm currently reading a book about cakePHP, but
> nee to skip through to resolve the world hunger crisis before I know how to
> grow corn.
>
> The situation:
> I have a
> model/controller/views(item.php/items_controller.php/view->admin_index.ctp
> and admin_add.ctp) that display items from a Mysql database. This works just
> as cakePHP wants, the table is designed with cakePHP in mind and the records
> are displayed in a table or a single record can be passed to a form for
> editing. I did not write this code, so maybe my issues are in understanding
> the code rather than cakePHP.
>
> I need, or want, to create a view that will list records from a non-cakePHP
> compliant database/table, Informix, in an HTML table that when the user
> clicks a link, will pre-populate the admin_add.ctp views form.
>
> I thought I could simply add my code to access this second database in the
> item.php model, and then call it via the controller, items_controller.php
> and send it to another view admin_select.ctp. However, I cannot get my
> function I wrote in the model to substitute the original table results with
> new results from the second database.
>
> Am I going about this incorrectly? if so, how would you suggest doing this?
> The intent is to simply import data from the Informix database into the
> mysql database when the admin wants to add an item.
>
> Thanks,
>
> Bruce Martin
> The Martin SolutionBruce at martinsolution.comhttp://www.martinsolution.com
>
>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
>



-- 
IM/iChat: ejpusa
Links: http://del.icio.us/ejpusa
Follow me: http://www.twitter.com/ejpusa
Karma: http://www.coderswithconscience.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20101123/6800b5df/attachment.html>


More information about the talk mailing list