标签: graphaware

在null上调用成员函数isCollection()

我,使用Graphaware Neo4j-php-OGM.我想访问二级关系.我无法看到让它发挥作用.我究竟做错了什么?

我正在尝试执行以下操作:

public function allowToContinue($userUuid, $permissionUuid)
    {
        $userRepo = $this->entityManager->getRepository(User::class);
        $permRoleRepo = $this->entityManager->getRepository(PermRole::class);
        $permissionRepo = $this->entityManager->getRepository(Permission::class);
        $user = $userRepo->findOneBy(['uuid' => $userUuid]);
        $permission = $permissionRepo->findOneBy(['uuid' => $permissionUuid]);
        $allowed = false;
        foreach ($user->getPermrole() as $userRole)
        {
            var_dump($userRole);
            $role = $permRoleRepo->findOneBy(['uuid' => $userRole->getUuid()]);
            var_dump($role);
            foreach ($role->getPermissions() as $perm)
            {
                var_dump($perm->getUuid());
                if($perm->getUuid() === $permissionUuid){
                    $allowed = true;
                }
            }
        }
        return $allowed;
    }
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

Error:
Call to a member function isCollection() on null

  at vendor/graphaware/neo4j-php-ogm/src/Hydrator/EntityHydrator.php:107
  at GraphAware\Neo4j\OGM\Hydrator\EntityHydrator->hydrateSimpleRelationshipCollection('permissions', object(Result), object(neo4j_ogm_proxy_App_Entity_Generic_PermRole))
     (vendor/graphaware/neo4j-php-ogm/src/Persisters/BasicEntityPersister.php:104)
  at GraphAware\Neo4j\OGM\Persisters\BasicEntityPersister->getSimpleRelationshipCollection('permissions', object(neo4j_ogm_proxy_App_Entity_Generic_PermRole)) …
Run Code Online (Sandbox Code Playgroud)

php neo4j symfony graphaware neo4j-php-ogm

8
推荐指数
1
解决办法
502
查看次数

Neo4j PHP Graphaware'400 Bad Content-Type header'错误

以下测试用例(假设密码正确)

<?php
    require_once "vendor/autoload.php";
    use GraphAware\Neo4j\Client\ClientBuilder;
    $client = ClientBuilder :: create() -> addConnection("default", "http://neo4j:Password@localhost:7474") -> build();
    $query  = "MATCH (u:User)
               RETURN u";
    $result = $client -> run($query);
    $user = $result -> firstRecord() -> values()[0];
?>
Run Code Online (Sandbox Code Playgroud)

给我以下错误:

PHP Fatal error:  Uncaught GuzzleHttp\\Exception\\ClientException: Client error: `POST http://neo4j:***@localhost:7474/db/data/transaction/commit` resulted in a `400 Bad Content-Type header value: ''` response in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\\Exception\\RequestException::create(Object(GuzzleHttp\\Psr7\\Request), Object(GuzzleHttp\\Psr7\\Response))
#1 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}(Object(GuzzleHttp\\Psr7\\Response))
#2 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\\Promise\\Promise::callHandler(1, Object(GuzzleHttp\\Psr7\\Response), Array)
#3 /var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\\Promise\\Promise::GuzzleHttp\\Promise\\{closure}()
#4 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\\Promise\\TaskQueue->run(true)
#5 /var/www/html/vendor/guzzlehttp/ in …
Run Code Online (Sandbox Code Playgroud)

php neo4j graphaware

6
推荐指数
1
解决办法
247
查看次数

GraphUnit - 事务集成测试和回滚

我目前正在使用GraphUnit,Spock和正在进行的Neo4j服务器对我的Spring Data Neo4j 4.0支持的应用程序进行集成测试.

它一直在我的测试操作之后做的图形数据库的状态断言一个非常漂亮的工具,但我注意到,为了让GraphUnit的assertGraph,并printGraph告诉我我的期望,我Neo4j的交易必须首先承诺.从逻辑上讲,这对我来说很有意义,但这也意味着我无法标记我的集成测试,@Transactional并且在一次测试中对进程数据库所做的任何数据更改都会导致后续测试.

我通过在Spock fixture方法中的每个测试方法之后清除数据库来处理这个并且这很好但我非常希望能够:

  • 设置测试Neo4j数据集ONCE
  • 每次测试后,测试方法更改都会回滚
  • 仍然可以使用GraphUnit的断言和打印实用程序

我的问题是 - 有没有办法完成这三个?如果我想使用GraphUnit,它是一个基本要求/假设事务提交?

neo4j graphaware spring-data-neo4j-4

3
推荐指数
1
解决办法
188
查看次数

neo4j-php-client中的错误处理程序

我下载并安装了neo4j-php-client和neo4j 2.3.2.实际上一切正常,但我只是想知道为什么这个php客户端没有错误处理程序?例如,如果cypher查询中存在错误,则没有错误抛出很容易捕获它.我通过网络搜索,但我找不到解决方案.

有人知道如何打开错误处理程序吗?

提前致谢.

php neo4j graphaware

0
推荐指数
1
解决办法
373
查看次数