couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jehan Bihin <kil...@daaboo.net>
Subject Problem with view using phpillow
Date Tue, 04 Jan 2011 16:56:17 GMT
Hi,

I (re)try to use couchDB & phpillow in a project and i try to put my php
sessions as documents in couchdb, but i have a problem...

I'm on Debian Lenny with the couchdb 1.0.1 build from sources with Erlang
build from sources too (R12B-5) and using phpillow 0.5alpha.

(exception properly var_dumped in attached file)

I have in my code :

  $vue = new sessionView();
  $sessions = $vue->query('sessions', array('key' => $id));
  if (count($sessions->rows) > 0) {
  ...

My view :

  class sessionView extends phpillowView
  {
    protected $viewDefinitions = array(
      'sessions' => "function (doc) {
        if (doc.type == 'session') emit(doc.id, doc._id);
       }"
    );

    protected function getViewName() {
      return 'session_vue';
    }
  }

And my document :

class sessionDocument extends phpillowDocument
{
  protected static $type = 'session';

  protected $requiredProperties = array(
    'id',
    'donnees',
    'expiration'
  );

  public function __construct() {
    $this->properties = array(
      'id' => new phpillowStringValidator(),
      'donnees' => new phpillowStringValidator(),
      'expiration' => new phpillowDateValidator()
    );

    parent::__construct();
  }

  protected function generateId() {
    return $this->stringToId($this->storage->id);
  }

  protected function getType() {
    return self::$type;
  }
}

When executing the line $vue->query, crash and a exception is throw just
saying :"phpillowResponseErrorException' with message 'Error (405) in
request: method_not_allowed (Only GET,HEAD allowed)"

In an older projet (couch < 0.11), the same line to list my documents is ok,
but now i have errors.

Have you an idea ? I'm blocked.

Thanks in advance,

*Jehan*
PS: Sorry for my bad english

Mime
View raw message