I have the following "User" class:
<?php
use GraphAware\Neo4j\OGM\Annotations as OGM;
/**
* @OGM\Node(label="User")
*/
class User {
/**
* @OGM\GraphID
* @var int
*/
protected $id;
/**
* @OGM\Property(type="string")
* @var string
*/
protected $username;
/*
* @OGM\Property(type="string")
* @var string
*/
protected $password;
/*
* @param string $username
* @param string $password
*/
public function __construct($username, $password) {
$this->username = $username;
$this->password = $password;
}
/*
* @return string
*/
public function getUsername() {
return $this->username;
}
/*
* @return string
*/
public function getPassword() {
return $this->password;
}
/*
* @param string $password
*/
public function setPassword($password) {
$this->password = $password;
}
}
I'm trying to work with it, as shown:
>>> require_once 'User.php'
=> 1
>>> use GraphAware\Neo4j\OGM\EntityManager;
=> null
>>> $manager = EntityManager::create('http://neo4j:superstrongpassword@localhost:7474');
=> GraphAware\Neo4j\OGM\EntityManager {#171
+"annotationDriver": GraphAware\Neo4j\OGM\Mapping\AnnotationDriver {#178},
}
>>> $x = new User('foo', 'bar');
=> User {#217}
>>> $manager->persist($x)
=> null
>>> $manager->flush()
=> null
However, if I run the following query in Neo4j "browser", I can just see the following being created:
$ match (x) return x
Rows
x: username: foo
Creation of the other properties are seemingly skipped.
I believe I'm missing something pretty basic; what is the problem with the above code?
The docblocks for the password @Property annotation are missing a *
:
/*
* @OGM\Property(type="string")
* @var string
*/
protected $password;
The first line : /*
should be with two stars /**
/**
* @OGM\Property(type="string")
* @var string
*/