array $data:
protected function createProfileFromData(array $data) {
$profile = $this
->getProfile($data);
if ($data['parent']) {
$parent = $this
->getMongo()
->findOne(array(
'_id' => $data['parent'],
'data' => array(
'$exists' => true,
),
));
if ($parent) {
$profile
->setParent($this
->getProfile($this
->getData($parent)));
}
}
$profile
->setChildren($this
->readChildren($data['token']));
return $profile;
}