Re: CakePHP without database access. Webservices only

2008-08-25 Thread LepinskiWA

I am using this approach on a project. Looking on the Internet found a
way using *datasources*.

var $webservice = array(
'datasource' => 'webservice'
);

create the file interactive_source.php inside model/datasources.. and
in the app_controller.php

class AppController extends Controller {

function beforeFilter()
{
// Instância o DataSource Fenix
$this->service =& 
ConnectionManager::getDataSource('webservice');
}
}

other approach is creating a behaviour for model tie to make the model
to acts as a webservice...

http://bakery.cakephp.org/articles/view/webservice-behavior

On Aug 22, 6:36 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Fri, Aug 22, 2008 at 2:49 PM, clemos <[EMAIL PROTECTED]> wrote:
>
> > I guess they want no tables ($useTable), but also no database at all...
> > Because even if you don't use tables at all, you'll need a database
> > connection to make Cake work...
> > Maybe a "dummy" datasource / db driver would be possible...
>
> Yes, create app/models/datasources/dbo/dbo_my_dbo_source.php
>
> add
>
> class DboMyDboSource extends DboSource
> {
> function connect()
> {
> $this->connected = true;
> return $this->connected;
>
> }
>
> function disconnect()
> {
> $this->connected = false;
> return !$this->connected;
>
> }
> }
>
> and use it by putting in database.php  'driver' => 'my_dbo_source'
>
> Note: This is in addition putting useTable = false in your models
>
> However a more elegant idea would be to abstract more of your
> webservice into the dbosource - we did this recently for Salesforge
> API
>
> HTH
> Tarique
>
> P.S. Probably disconnect method is not needed - experiment with it
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP without database access. Webservices only

2008-08-22 Thread Dr. Tarique Sani

On Fri, Aug 22, 2008 at 2:49 PM, clemos <[EMAIL PROTECTED]> wrote:
>
> I guess they want no tables ($useTable), but also no database at all...
> Because even if you don't use tables at all, you'll need a database
> connection to make Cake work...
> Maybe a "dummy" datasource / db driver would be possible...


Yes, create app/models/datasources/dbo/dbo_my_dbo_source.php

add

class DboMyDboSource extends DboSource
{
function connect()
{
$this->connected = true;
return $this->connected;
}

function disconnect()
{
$this->connected = false;
return !$this->connected;
}
}

and use it by putting in database.php  'driver' => 'my_dbo_source'

Note: This is in addition putting useTable = false in your models

However a more elegant idea would be to abstract more of your
webservice into the dbosource - we did this recently for Salesforge
API

HTH
Tarique

P.S. Probably disconnect method is not needed - experiment with it

--
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP without database access. Webservices only

2008-08-22 Thread clemos

I guess they want no tables ($useTable), but also no database at all...
Because even if you don't use tables at all, you'll need a database
connection to make Cake work...
Maybe a "dummy" datasource / db driver would be possible...

+++
Clément

On Fri, Aug 22, 2008 at 7:51 AM, chovy <[EMAIL PROTECTED]> wrote:
>
>
>
> On Aug 13, 8:49 am, Bob Mattax <[EMAIL PROTECTED]> wrote:
>> I am working on a current application that doesn't have any direct
>> access to the database.  The powers that be have limited all data
>> requests and updates through a series of webservices.  No big deal.
>>
>> The only problem I have is trying to prevent Cake from going through
>> the motions of requiring a default DB config etc.
>>
>> When I have debugging set to 3, it will still give me the FATAL
>> warning that it can't find my DB.
>>
>> useTable = null/false  does not work.
>>
>> Any suggestions?
>>
>
>
> I have the exact same need right now. I've looked at Rails, but cannot
> find any good examples on this (everything is geared towards providing
> a web service, not consuming one).
>
> Please, *please* let me know if you find a way to do it that still
> takes advantage of MVC, and generators, etc.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP without database access. Webservices only

2008-08-22 Thread chovy



On Aug 13, 8:49 am, Bob Mattax <[EMAIL PROTECTED]> wrote:
> I am working on a current application that doesn't have any direct
> access to the database.  The powers that be have limited all data
> requests and updates through a series of webservices.  No big deal.
>
> The only problem I have is trying to prevent Cake from going through
> the motions of requiring a default DB config etc.
>
> When I have debugging set to 3, it will still give me the FATAL
> warning that it can't find my DB.
>
> useTable = null/false  does not work.
>
> Any suggestions?
>


I have the exact same need right now. I've looked at Rails, but cannot
find any good examples on this (everything is geared towards providing
a web service, not consuming one).

Please, *please* let me know if you find a way to do it that still
takes advantage of MVC, and generators, etc.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---