Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Implemented skip in findBy method in Repository class #157

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tomcyr
Copy link
Contributor

@tomcyr tomcyr commented Jan 28, 2013

There was $offset argument but it was nothing meaning for query:)

@odino
Copy link
Member

odino commented Jan 29, 2013

Hi tomcyr,

what about adding a test for this PR?

@tomcyr
Copy link
Contributor Author

tomcyr commented Jan 29, 2013

Hi @odino,
OK, I'll do it later.

@odino
Copy link
Member

odino commented Jan 29, 2013

great, thanks!

@tomcyr
Copy link
Contributor Author

tomcyr commented Jan 31, 2013

tomcyr@dcddc4a - http status 100 we have as response when updating documents

@odino
Copy link
Member

odino commented Jan 31, 2013

@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?

@lvca
Copy link

lvca commented Jan 31, 2013

@odino you should receive 200 if ok

@odino
Copy link
Member

odino commented Jan 31, 2013

@tomcyr is there any way we can reproduce why we're getting 100 Continue?

@tomcyr
Copy link
Contributor Author

tomcyr commented Jan 31, 2013

OK, let's say we have example test records in db from this example: #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

@tomcyr
Copy link
Contributor Author

tomcyr commented Feb 1, 2013

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

@tomcyr
Copy link
Contributor Author

tomcyr commented Feb 1, 2013

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??

@odino
Copy link
Member

odino commented Feb 3, 2013

@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...

@odino
Copy link
Member

odino commented May 7, 2013

hey @tomcyr, any news on this?

@tomcyr
Copy link
Contributor Author

tomcyr commented May 22, 2013

hey @odino, because nothing happened with orientdb-odm last few months I used mongo :(

@odino
Copy link
Member

odino commented May 22, 2013

ok, no worries :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants