-
Notifications
You must be signed in to change notification settings - Fork 2
GEDCOM X Serialization
Jimmy Zimmerman edited this page Jul 17, 2015
·
2 revisions
use Gedcomx\Gedcomx;
use Gedcomx\Conclusion\Person;
use Gedcomx\Conclusion\Relationship;
use Gedcomx\Conclusion\Document;
use Gedcomx\Source\SourceDescription;
...
$gedcomx = new Gedcomx();
$person1 = new Person();
$relationship1 = new Relationship();
$document1 = new Document();
$source1 = new SourceDescription();
...
$gedcomx->setPersons(array(person1, ...));
$gedcomx->setRelationships(array(relationship1, ...));
$gedcomx->setDocuments(array(document1, ...));
$gedcomx->setSourceDescriptions(array(source1, ...));
$json = $gedcomx->toJson();
use Gedcomx\Gedcomx;
use Gedcomx\Conclusion\Person;
use Gedcomx\Conclusion\Relationship;
use Gedcomx\Conclusion\Document;
use Gedcomx\Source\SourceDescription;
/**
* @var string
*/
$json = ...;
/**
* @var Gedcomx
*/
$gedcomx = new Gedcomx(json_decode($json, true));
/**
* @var Person
*/
$person1 = $gedcomx->getPersons()[0];
/**
* @var Relationship
*/
$relationship1 = $gedcomx->getRelationships()[0];
/**
* @var Document
*/
$document1 = $gedcomx->getDocuments()[0];
/**
* @var SourceDescription
*/
$source1 = $gedcomx->getSourceDescriptions()[0];
...