函数persist中的140个查询(Neo4j graphaware OGM for PHP)
我有一个包含9种节点类型、9种关系类型和50个条目(节点和关系)的数据库,当我尝试保存一个新节点时,库会在函数中保存140个查询 我的PHP代码:函数persist中的140个查询(Neo4j graphaware OGM for PHP),php,neo4j,graphaware,Php,Neo4j,Graphaware,我有一个包含9种节点类型、9种关系类型和50个条目(节点和关系)的数据库,当我尝试保存一个新节点时,库会在函数中保存140个查询 我的PHP代码: $iUser = new User(); $iUser->setEmail($mail); $iUser->setName($name); $this->getEntityManager()->persist($iUser); // <-- It's do 140 queries $this->getEntityM
$iUser = new User();
$iUser->setEmail($mail);
$iUser->setName($name);
$this->getEntityManager()->persist($iUser); // <-- It's do 140 queries
$this->getEntityManager()->flush();
graphaware/neo4j-bolt 1.10.0
graphaware/neo4j-common 3.5.0
graphaware/neo4j-php-client 4.8.1
graphaware/neo4j-php-ogm 1.0.0-RC5
库版本:
$iUser = new User();
$iUser->setEmail($mail);
$iUser->setName($name);
$this->getEntityManager()->persist($iUser); // <-- It's do 140 queries
$this->getEntityManager()->flush();
graphaware/neo4j-bolt 1.10.0
graphaware/neo4j-common 3.5.0
graphaware/neo4j-php-client 4.8.1
graphaware/neo4j-php-ogm 1.0.0-RC5
对于数据库中的关系和其他ID,查询始终重复,如果相同的查询更改了名称关系或ID,则查询为:
查询
MATCH (n) WHERE id(n) = {id} RETURN size((n)<-[:`<name relation>`]-()) AS users
Parameter: array:1 [▼
"id" => 189
]
MATCH (n) WHERE id(n) = {id} MATCH (n)<-[vendor_neo4j_entity_roleentity_users:`HAVE_ROL_GLOBAL`]-(vendor_neo4j_entity_haverolglobalrelationship) RETURN {target: startNode(vendor_neo4j_entity_roleentity_users), re: vendor_neo4j_entity_roleentity_users} AS vendor_neo4j_entity_roleentity_users
Parameter: array:1 [▼
"id" => 189
]
第二次查询跟踪
0 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\Persisters\BasicEntityPersister.php"
"line" => 131
"function" => "run"
"class" => "GraphAware\Neo4j\Client\Client"
]
1 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\Proxy\RelationshipEntityCollectionInitializer.php"
"line" => 29
"function" => "getCountForRelationship"
"class" => "GraphAware\Neo4j\OGM\Persisters\BasicEntityPersister"
]
2 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\Proxy\LazyCollection.php"
"line" => 87
"function" => "getCount"
"class" => "GraphAware\Neo4j\OGM\Proxy\RelationshipEntityCollectionInitializer"
]
3 => array:4 [▼
"file" => ""
"line" => 0
"function" => "count"
"class" => "GraphAware\Neo4j\OGM\Proxy\LazyCollection"
]
4 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 493
"function" => "count"
"class" => ""
]
5 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 150
"function" => "traverseRelationshipEntities"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
6 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 501
"function" => "doPersist"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
7 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 150
"function" => "traverseRelationshipEntities"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
8 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 123
"function" => "doPersist"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
9 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\EntityManager.php"
"line" => 223
"function" => "persist"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
10 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\src\vendor\Neo4j\Repository\UserRepository.php"
"line" => 184
"function" => "persist"
"class" => "GraphAware\Neo4j\OGM\EntityManager"
]
11 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\src\vendor\CoreBundle\Controller\UsersController.php"
"line" => 214
"function" => "editUser"
"class" => "vendor\Neo4j\Repository\UserRepository"
]
12 => array:4 [▼
"file" => ""
"line" => 0
"function" => "saveUserAction"
"class" => "vendor\CoreBundle\Controller\UsersController"
]
13 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php"
"line" => 153
"function" => "call_user_func_array"
"class" => ""
]
14 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php"
"line" => 68
"function" => "handleRaw"
"class" => "Symfony\Component\HttpKernel\HttpKernel"
]
15 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php"
"line" => 171
"function" => "handle"
"class" => "Symfony\Component\HttpKernel\HttpKernel"
]
16 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\web\app.php"
"line" => 20
"function" => "handle"
"class" => "Symfony\Component\HttpKernel\Kernel"
0 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\Persisters\BasicEntityPersister.php"
"line" => 122
"function" => "run"
"class" => "GraphAware\Neo4j\Client\Client"
]
1 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\Proxy\RelationshipEntityCollectionInitializer.php"
"line" => 22
"function" => "getRelationshipEntityCollection"
"class" => "GraphAware\Neo4j\OGM\Persisters\BasicEntityPersister"
]
2 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\Proxy\LazyCollection.php"
"line" => 52
"function" => "initialize"
"class" => "GraphAware\Neo4j\OGM\Proxy\RelationshipEntityCollectionInitializer"
]
3 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\doctrine\collections\lib\Doctrine\Common\Collections\AbstractLazyCollection.php"
"line" => 332
"function" => "doInitialize"
"class" => "GraphAware\Neo4j\OGM\Proxy\LazyCollection"
]
4 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\doctrine\collections\lib\Doctrine\Common\Collections\AbstractLazyCollection.php"
"line" => 274
"function" => "initialize"
"class" => "Doctrine\Common\Collections\AbstractLazyCollection"
]
5 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 497
"function" => "getIterator"
"class" => "Doctrine\Common\Collections\AbstractLazyCollection"
]
6 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 150
"function" => "traverseRelationshipEntities"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
7 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 501
"function" => "doPersist"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
8 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 150
"function" => "traverseRelationshipEntities"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
9 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\UnitOfWork.php"
"line" => 123
"function" => "doPersist"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
10 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\graphaware\neo4j-php-ogm\src\EntityManager.php"
"line" => 223
"function" => "persist"
"class" => "GraphAware\Neo4j\OGM\UnitOfWork"
]
11 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\src\vendor\Neo4j\Repository\UserRepository.php"
"line" => 184
"function" => "persist"
"class" => "GraphAware\Neo4j\OGM\EntityManager"
]
12 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\src\vendor\CoreBundle\Controller\UsersController.php"
"line" => 214
"function" => "editUser"
"class" => "vendor\Neo4j\Repository\UserRepository"
]
13 => array:4 [▼
"file" => ""
"line" => 0
"function" => "saveUserAction"
"class" => "vendor\CoreBundle\Controller\UsersController"
]
14 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php"
"line" => 153
"function" => "call_user_func_array"
"class" => ""
]
15 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php"
"line" => 68
"function" => "handleRaw"
"class" => "Symfony\Component\HttpKernel\HttpKernel"
]
16 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php"
"line" => 171
"function" => "handle"
"class" => "Symfony\Component\HttpKernel\HttpKernel"
]
17 => array:4 [▼
"file" => "C:\wamp64\www\vCheck\web\app.php"
"line" => 20
"function" => "handle"
"class" => "Symfony\Component\HttpKernel\Kernel"
]
有人知道如何解决这个问题吗?你能用查询显示调试吗?以及你的ogm版本吗?我编辑帖子并添加这些信息。这是你代码运行的唯一部分吗?如果您告诉我您有这些针对其他ID的查询,那么一些代码应该加载这些实体。我添加了跟踪代码,其中包含流程中运行的所有脚本。当我创建一个节点时,只需执行+-85查询和编辑+-140。你能用查询显示调试吗?以及你的ogm版本吗?我编辑帖子并添加此信息。这是你运行代码的唯一部分吗?如果您告诉我您有这些针对其他ID的查询,那么一些代码应该加载这些实体。我添加了跟踪代码,其中包含流程中运行的所有脚本。就是这样,当我创建一个节点时,执行+-85次查询,当编辑+-140次查询。