Answer the question
In order to leave comments, you need to log in
PHPCR How to create a node with a user?
Hello. When I try to create a document for a user using PHPCR, I get an error:
In NamespaceRegistry.php line 193:
Mapping for 'rep' is not defined
/**
* @Document(nodeType="rep:User")
*/
class UserDocument implements HierarchyInterface
{
/**
* @Id(strategy="parent")
*/
private $id;
/**
* @Nodename()
*/
private $nodeName;
/**
* @ParentDocument()
*/
private $parent;
/**
* @Field(property="rep:password")
*/
private $password;
public function getId(): ?int
{
return $this->id;
}
public function getParent()
{
return $this->getParentDocument();
}
public function setParent($parent)
{
return $this->setParentDocument($parent);
}
public function getParentDocument()
{
return $this->parent;
}
public function setParentDocument($parent)
{
$this->parent = $parent;
return $this;
}
/**
* @return mixed
*/
public function getNodeName()
{
return $this->nodeName;
}
/**
* @param string $nodeName
* @return ArticleDocument
*/
public function setNodeName(string $nodeName)
{
$this->nodeName = $nodeName;
return $this;
}
/**
* @return mixed
*/
public function getPassword()
{
return $this->password;
}
/**
* @param mixed $password
* @return ArticleDocument
*/
public function setPassword($password): ArticleDocument
{
$this->password = $password;
return $this;
}
}
$article = new UserDocument();
$article->setParentDocument($members);
$article->setNodeName('userNode');
$article->setPassword('testPassword');
$manager->persist($article);
$manager->flush();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question