diff --git a/lib/Doctrine/Resource/Client.php b/lib/Doctrine/Resource/Client.php index dc1f7eb74..730339b23 100644 --- a/lib/Doctrine/Resource/Client.php +++ b/lib/Doctrine/Resource/Client.php @@ -88,24 +88,9 @@ class Doctrine_Resource_Client extends Doctrine_Resource } } - public function find($model, $pk) + public function getTable($table) { - $record = $this->newRecord($model); - - $pk = is_array($pk) ? $pk:array($pk); - $identifier = $record->identifier(); - $identifier = is_array($identifier) ? $identifier:array($identifier); - - $where = ''; - foreach (array_keys($identifier) as $key => $name) { - $value = $pk[$key]; - $where .= $model.'.' . $name . ' = '.$value; - } - - $query = new Doctrine_Resource_Query(); - $query->from($model)->where($where)->limit(1); - - return $query->execute()->getFirst(); + return new Doctrine_Resource_Table($table); } public function newQuery() diff --git a/playground/index.php b/playground/index.php index 9f5ea2af6..a1d1ca1b1 100644 --- a/playground/index.php +++ b/playground/index.php @@ -18,8 +18,9 @@ if ($action == 'server') { $config = array('url' => 'http://localhost/~jwage/doctrine_trunk/playground/index.php?action=server'); $client = Doctrine_Resource_Client::getInstance($config); + $table = $client->getTable('User'); - $user = $client->find('User', 4); + $user = $table->find(4); $user->Phonenumber->add()->phonenumber = '555-5555'; $user->name = 'jonnwage'; $user->save();