我正在努力从 neo4j 数据库中读取数据。我使用 neo4j-php-ogm 库中提供的 entitymanager。
$employeesRepository = $this->entityManager ->getRepository(Employee::class);
$employees = $employeesRepository->findAll();
return $employees;
我以 json 格式返回它,输出是:[{},{},{}]
这是我的员工实体类:
<?php
use GraphAware\Neo4j\OGM\Annotations as OGM;
/**
* @OGM\Node(label="Employee")
*/
class Employee{
/**
* @OGM\GraphId()
* @var int
*/
protected $id;
/**
* @OGM\Property(type="string")
* @var string
*/
protected $last_name;
/**
* @OGM\Property(type="string")
* @var string
*
*/
protected $first_name;
/**
* @return int
*/
public function getid(){
return $this->id;
}
/**
* @return string
*/
public function getlast_name(){
return $this->last_name;
}
/**
* @param string last_name
*/
public function setlast_name($param){
$this->last_name = $param;
}
/**
* @return string
*/
public function getfirst_name() {
return $this->first_name;
}
/**
* @param string first_name
*/
public function setfirst_name($param) {
$this->first_name = $param;
}
}
我错过了什么?