Re: Re: Controller
| From: | Justin Patrin | Date: | Mon, 29 Nov 2004 17:25:20 +0000 |
| Subject: | Re: Re: Controller | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15905@lists.php.net to get a copy of this message | ||
On 29 Nov 2004 16:29:40 -0000, Matthew Weier O'Phinney
<matthew@garden.org> wrote:
> * Jacques Nunes <iacques@yahoo.com.br>:
> > 1 - There is any package for make a Page Controller in Pear? If no
> > Anybody know how to implement whith the existing classes?
> >
> > { controller -> validate request -> include classe -> object create}
>
> This sounds like you're looking for a class that implements an
> MVC-pattern. I'm not aware of any on PEAR, but there are a bunch listed
> at:
>
> http://wact.sourceforge.net/index.php/ModelViewController
>
> (Shameless plug: I'm the author of the PHP port of CGI::Application:
> http://freshmeat.net/projects/cgiapp/ )
>
> > 2 - To use PEAR::Error, I need extends the Pear classes, or I need
> > include the pear and instanciate the error method?
>
> You will need to include the PEAR class somewhere in your script/class,
> and then you can raise a PEAR_Error with the following constructions:
>
> $error = PEAR::raiseError($errMsg, $errNo);
Note that the above is the preferred method as it allows normal PEAR
error handling.
> $error = new PEAR_Error($errMsg, $errNo);
>
> Additionally, you could have your class extend PEAR, and then you can
> do things like:
>
> $error = $this->raiseError($errMsg, $errNo);
>
You can also create your own error object which extends PEAR_Error.
You can then easily tell the difference between a normal PEAR_Error
and yours. I think that DB may do this.
--
Justin Patrin