orientdb-odm
orientdb-odm copied to clipboard
Implemented skip in findBy method in Repository class
There was $offset argument but it was nothing meaning for query:)
Hi tomcyr,
what about adding a test for this PR?
Hi @odino, OK, I'll do it later.
great, thanks!
https://github.com/tomcyr/orientdb-odm/commit/dcddc4a392e7392a628e9edddb8bcc1c5d780739 - http status 100 we have as response when updating documents
@tomcyr great job! Im just gonna check one thing with luca garulli.
@lvca, is it normal that we get a response 100 Continue when updating a document through the HTTP protocol?
@odino you should receive 200 if ok
@tomcyr is there any way we can reproduce why we're getting 100 Continue?
OK, let's say we have example test records in db from this example: https://github.com/doctrine/orientdb-odm/issues/158
Next in my action:
/**
* @Route("/api/test")
*/
public function indexAction()
{
$manager = $this->container->get('odm');
$tests = $manager->getRepository('\ConceptIt\SmartShopperBundle\Entity\Test')->findBy(array(), array(), 10);
foreach($tests as $key => $test){
$test->setName('aaa'.$key);
$manager->persist($test);
}
}
And then I receive HTTP STATUS 100 and response text 'Record '#14:0' updated successful'. I'm almost sure if I was persist object first time and then I was updating but without getting it from repository I received HTTP STATUS 200 but I'll check it later. And of course I'm using persist method from this branch: https://github.com/tomcyr/orientdb-odm/tree/custompersist
OK, I know now but it's very strange: After update record I have response with headers: HTTP/1.1 200 OK Date: Fri Feb 01 01:41:06 CET 2013 Content-Type: text/plain; charset=utf-8 Server: OrientDB Server v.1.3.0 (build @BUILD@) Connection: Keep-Alive Set-Cookie: OSESSIONID=OS13596792653036567721899010732517; Path=/; HttpOnly Content-Length: 34
Record #12:1 updated successfully. 500 Internal Server Error - InvalidQueryException
so I dump before Exception InvalidQueryException, in code:
public function getData()
{
if (!$this->isValid()) {
var_dump($this->response->getStatusCode());
throw new InvalidQueryException($this->response->getBody(), $this);
}
$body = $this->response->getBody();
if (null === $json = json_decode($body)) {
if ($this->isValidRid($body)) {
return $body;
} elseif ($body === "") {
return true;
}
throw new \RuntimeException("Invalid JSON payload");
}
return $json;
}
and in dump i have 100 !!! Isn't strange?? So I added status_continue into valid responses
There is another problem yet. If we're updating document in Orient DB which has @version > 0 we must send our @version in request. We have @version of document in response when we're getting it from db but we must have it in our object. So the simplest way is to add property version with name @version in annotation in every Entity class. But I'm wonder if there is any better place for it??
@tomcyr like for the RID, I think it makes sense to add a custom property
@nrk what about having a trait for that? The thing is, how to gracefully degradate when we're using php 5.3...
hey @tomcyr, any news on this?
hey @odino, because nothing happened with orientdb-odm last few months I used mongo :(
ok, no worries :)