I've just started playing with PHP/MVC framworks in general and have been quite taken by Yii.
I'm trying to determine the best way to develop a web app whose model is actually an external java webservice.
I currently have a couple classes that extend CFormModel, and things do work, but the code is rather ugly and I think I'm departing from the MVC pattern a little more than I would like.
Any suggestions or recommendations for general model persistence via webservices or anything specific to Yii?
update - I realize that maybe my web app shouldn't have a model at all and should use the webservice directly from my controllers, but I really don't like the way the webservice objects are modelled and was trying to come up with some more elegant objects for my app to consume. Pipe dream?
Could you please explain this line? "...to develop a web app whose model is actually an external java webservice."
Sure. I'm working on a 3-tier application and I'm responsible for the frontend piece only. I have a small set of business logic within my application, but for the most part the business logic and data persistence lives on a remote java application. I talk to that application through SOAP based webservices only. So I'm trying to come up with an elegant way to accomplish this within the MVC pattern while leveraging Yii.
Because Yii doesn't have built-in support for SOAP client, you will need to use third-party (e.g. nusoap) or PHP soap extension.
I think you need a class map mapping between remote classes and local PHP ones. The local classes can be written by extending CModel. They serve for two purposes: 1. they hold the data 2. they provide methods that perform remote call. The latter should be mainly called at class level (very similar to those find methods in CActiveRecord).
Just rough ideas. Maybe you can share with us your design and progress?
I did end up using the PHP soap extension (and it's working well). I'll be very happy to keep you posted on how it's going. I'm under a pretty tight timeline with this project and I'm fairly new to PHP, so I may just have to have the controllers do the lifting for now and rely on a not-so-nice model. I fully intend to come up with something useful and extensible when I have more time to think (and after I've wrapped my head around PHP in general).