1. Go to this page and download the library: Download mtchabok/objects_relation library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mtchabok / objects_relation example snippets
use \Mtchabok\ObjectsRelation\Relation;
class myObjectUseTraitClass{
use Relation;
public $name = '';
public function __construct()
{
$this->addRelationType('parent', 'child');
$this->addRelationType('child', 'parent');
}
}
use \Mtchabok\ObjectsRelation\RelationObject;
class myObjectExtendsClass extends RelationObject{
public $name = '';
public function __construct()
{
$this->addRelationType('parent', 'child');
$this->addRelationType('child', 'parent');
}
}
use \Mtchabok\ObjectsRelation\Relation;
use \Mtchabok\ObjectsRelation\RelationChild;
use \Mtchabok\ObjectsRelation\RelationParent;
class myObjectParentChildTraitClass{
use Relation;
use RelationParent{ RelationParent::__construct as __parentConstruct; }
use RelationChild{ RelationChild::__construct as __childConstruct; }
public $name = '';
public function __construct()
{
$this->__parentConstruct();
$this->__childConstruct();
}
}