To define entities using annotations, add the following use-statement on top (as known from Doctrine ORM):
use HireVoice\Neo4j\Annotation as OGM;
/**
* @OGM\Entity()
*/
class MyEntity
{
// definition
}
/**
* @OGM\Entity(repositoryClass="Repository\UserRepository")
*/
class MyEntityWithCustomRepository
{
// definition
}
/**
* @OGM\Entity(labels="Location,City")
*/
class MyLabeledEntity
{
//...
}
This is used to define primary-keys automaticly.
/**
* @OGM\Auto
*/
protected $id;
Use this annotation to store the selected property into the neo4j graph.
/**
* @OGM\Property
*/
protected $name;
Optionally, a format can be defined. Default is scalar.
/**
* @OGM\Property(format="date")
*/
protected $releaseDate;
Use this annotation to add a property to the (search) index. This can only be used along with @OGM\Property.
/**
* @OGM\Property
* @OGM\Index
*/
protected $name;
Defines a many to one relation.
/**
* @OGM\ManyToOne
*/
protected $mainActor;
Optionally, a relation name can be defined.
/**
* @OGM\ManyToOne(relation="acts-in")
*/
protected $mainActor;
Defines a many to many relation. Configuration is the same as @OGM\ManyToOne