These are chat archives for neoxygen/neo4j-neoclient

26th
Oct 2014
Christophe Willemsen
@ikwattro
Oct 26 2014 17:30
@Mulkave hey ;-)
Abed Halawi
@Mulkave
Oct 26 2014 17:31
hello there!
yup here's better, can we $code ?
aha that sounds good :smile:
Christophe Willemsen
@ikwattro
Oct 26 2014 17:32
yes code like on github
Abed Halawi
@Mulkave
Oct 26 2014 17:32
:thumbsup:
Christophe Willemsen
@ikwattro
Oct 26 2014 17:32
btw I will eat, do you have a 1/2 hour
?
Abed Halawi
@Mulkave
Oct 26 2014 17:33
sure I'll be doing some thinking over NeoEloquent
Abed Halawi
@Mulkave
Oct 26 2014 17:38
Just pulled the latest version of 2.0

This code:

$q = 'MATCH (n)-[r]-(m) DELETE r,n,m';
$client->sendCypherQuery($q, [], null, array('graph'));

is returning:

1) ClientTest::testCreatingElement
Undefined offset: 0

/Users/Mulkave/Developer/Sandbox/neoclient-tryout/workbench/mulkave/neoclient-tryout/vendor/neoxygen/neoclient/src/Formatter/Response.php:21
/Users/Mulkave/Developer/Sandbox/neoclient-tryout/workbench/mulkave/neoclient-tryout/vendor/neoxygen/neoclient/src/Formatter/ResponseFormatter.php:48
/Users/Mulkave/Developer/Sandbox/neoclient-tryout/workbench/mulkave/neoclient-tryout/vendor/neoxygen/neoclient/src/Client.php:45
Array
(
    [results] => Array
        (
            [0] => Array
                (
                    [columns] => Array
                        (
                        )

                    [data] => Array
                        (
                        )

                )

        )

    [errors] => Array
        (
        )

)
Christophe Willemsen
@ikwattro
Oct 26 2014 17:54
I come in 15 min it's ok ?
Christophe Willemsen
@ikwattro
Oct 26 2014 18:31
I'm trying on mobile
Abed Halawi
@Mulkave
Oct 26 2014 18:31
sure, will be here
Christophe Willemsen
@ikwattro
Oct 26 2014 18:31
she's on ikea website, rrrrrrrh
so other problems?
Abed Halawi
@Mulkave
Oct 26 2014 18:31
hahah shopping...
Christophe Willemsen
@ikwattro
Oct 26 2014 18:35
I just pushed a fix for the error
forgot to check for emptyness of errors
Abed Halawi
@Mulkave
Oct 26 2014 18:36
:+1: pulling now
Christophe Willemsen
@ikwattro
Oct 26 2014 18:36
Also, an error will be thrown if there are cypher errors
now
Abed Halawi
@Mulkave
Oct 26 2014 18:36
that's better
Abed Halawi
@Mulkave
Oct 26 2014 18:52
it seems like you're dumping the result
and yes getNodes('Label', true) is not returning labelized keys
Christophe Willemsen
@ikwattro
Oct 26 2014 18:55
ok will check
btw
I did not remember any changes to getNodes ? did I ?
where is the result dump ?
ho yes
the $labelizedKeys
Abed Halawi
@Mulkave
Oct 26 2014 18:57
the dump is when calling getResult()
Christophe Willemsen
@ikwattro
Oct 26 2014 19:00
yep forgot a print
pushed the fix
Abed Halawi
@Mulkave
Oct 26 2014 19:00
alright pulling now
Christophe Willemsen
@ikwattro
Oct 26 2014 19:00
You know what, i don't find the commit with the $labelizedKeys anymore lol :)
The first arguments was an array of nodes you could pass, right ?
sorry an array of labels
for getNodes
or only one label
?
Abed Halawi
@Mulkave
Oct 26 2014 19:04
hmm
one label
it would definitely be useful with an array as well
Christophe Willemsen
@ikwattro
Oct 26 2014 19:05
I pushed a temporary fix for one label
for multiple labels
I would prefer a getNodesByLabels method
to avoid to have multiple types for one property
what do you think ?
Abed Halawi
@Mulkave
Oct 26 2014 19:10
PHP Fatal error:  Cannot use object of type Neoxygen\NeoClient\Client as array in /Users/Mulkave/Developer/Sandbox/neoclient-tryout/workbench/mulkave/neoclient-tryout/vendor/neoxygen/neoclient/src/Formatter/Response.php on line 19
Christophe Willemsen
@ikwattro
Oct 26 2014 19:11
Rarz
Rare
is there a more stack ?
because Response line 19 has nothing to do with the Client
Abed Halawi
@Mulkave
Oct 26 2014 19:12
honestly I'm personally a fan of calling the same function with multiple data types, it makes things easier and less methods to remember. Like getNodes('Label') and `getNodes(['LabelOne', 'LabelTwo'])
Christophe Willemsen
@ikwattro
Oct 26 2014 19:12
Can you paste the code you use that trigger the error ?
ok for multiple types
in fact for me it remains the same, i do not have currently use cases when I want to have multiple labels
So I'll change it ;-)
Abed Halawi
@Mulkave
Oct 26 2014 19:13
$client = $this->getClient();
        $q = 'CREATE (u:`User` {name: {name}, email: {email}}) RETURN u';
        $params = ['name' => 'Abed Halawi', 'email' => 'halawi.abed@gmail.com'];
        $result = $client->sendCypherQuery($q, $params, null, array('graph'))->getResult();
        $this->assertInstanceOf('Neoxygen\NeoClient\Formatter\Result', $result);
cool :wink:
Christophe Willemsen
@ikwattro
Oct 26 2014 19:15
I do not have errors when running the same query
```bash
Neoxygen\NeoClient\Formatter\Result Object
(
    [nodes:protected] => Array
        (
            [4368] => Neoxygen\NeoClient\Formatter\Node Object
                (
                    [id:protected] => 4368
                    [labels:protected] => Array
                        (
                            [0] => User
                        )

                    [properties:protected] => Array
                        (
                            [name] => Abed Halawi
                            [email] => halawi.abed@gmail.com
                        )

                    [inboundRelationships:protected] => Array
                        (
                        )

                    [outboundRelationships:protected] => Array
                        (
                        )

                )

        )

    [relationships:protected] => Array
        (
        )

    [errors:protected] => 
)
Abed Halawi
@Mulkave
Oct 26 2014 19:15
add this to them
$this->assertArrayHasKey('User', $result->getNodes('User', true));
although the error is triggered even when this is not there
Christophe Willemsen
@ikwattro
Oct 26 2014 19:16
yes
did you reupdated the client
I just pushed the getNodes fix
Abed Halawi
@Mulkave
Oct 26 2014 19:17
yup am pulling 2.0
From git://github.com/neoxygen/neo4j-neoclient
 * branch            2.0        -> FETCH_HEAD
Already up-to-date.
Christophe Willemsen
@ikwattro
Oct 26 2014 19:19
working for me
$this->assertArrayHasKey('User', $result->getNodes('User', true));
Abed Halawi
@Mulkave
Oct 26 2014 19:24
just pulled again, seems to have pulled some stuff
testing now
yup working :+1:
what happened to $client->getRoot()?
Christophe Willemsen
@ikwattro
Oct 26 2014 19:28
ho
seems to be returning me the container
:)
will fix that
Abed Halawi
@Mulkave
Oct 26 2014 19:28
alright
Christophe Willemsen
@ikwattro
Oct 26 2014 19:35
You forgot to add getResponse()
I presume
if you do not call getResponse or getResult
it returns you the Client object
which has the container inside
I can avoid it by not returning the client object in the __call
BUT you'll have to do things in two ways then
$response = $client->sendCypherQuery($q);
$result = $response->getResult();
Abed Halawi
@Mulkave
Oct 26 2014 19:36
hmm
that's the issue of getRoot() ?
Christophe Willemsen
@ikwattro
Oct 26 2014 19:37
Yes
because in the _call method I'm returning $this
Abed Halawi
@Mulkave
Oct 26 2014 19:37
aha
how is it achievable with the current implementation ?
Christophe Willemsen
@ikwattro
Oct 26 2014 19:37
for allowing to bind methods after like getResponse or getResult
you can have getRoot
Abed Halawi
@Mulkave
Oct 26 2014 19:38
let me try that
Christophe Willemsen
@ikwattro
Oct 26 2014 19:38
but you need to do `$client->getRoot()->getResponse();
you need to call OR getResponse() OR getResult() on each call you do
otherwise you get the Client instance which contains the container object
Abed Halawi
@Mulkave
Oct 26 2014 19:39
hmm
I think for getRoot() there should be an exceptional case for backward compatibility
Christophe Willemsen
@ikwattro
Oct 26 2014 19:39
Well as it is for 2.0, I can break up things
all calls are breaked with the new way
OR
You'll need to do :
Abed Halawi
@Mulkave
Oct 26 2014 19:40
yea that's why it's an exception
it worked with $client->getRoot()->getResponse()
Christophe Willemsen
@ikwattro
Oct 26 2014 19:40
$response = $client->getRoot()
and will return you the array of the two main endpoints
but this will change for all the methods then
Abed Halawi
@Mulkave
Oct 26 2014 19:41
what other methods ?
Christophe Willemsen
@ikwattro
Oct 26 2014 19:41
sendCypherQuery, ...
if I change for getRoot
it changes for all
OR I need to add a getRoot method in the client
and not more in the core extension
which can be in fact more feasible
Abed Halawi
@Mulkave
Oct 26 2014 19:42
hmm, how about the getRoot() method calls getResponse() internally ? Is it possible ?
that way you can keep the extension
Christophe Willemsen
@ikwattro
Oct 26 2014 19:43
nope, the getRoot method don't have access to the response formatter
the response format is done in last step
but I can add an exception in the Client class
as the Client is the Root also of the NeoClient system
it seems cool
:)
Abed Halawi
@Mulkave
Oct 26 2014 19:44
:+1:
Christophe Willemsen
@ikwattro
Oct 26 2014 23:41
btw you can also do $client-