1. Go to this page and download the library: Download vrok/ref-helper 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/ */
vrok / ref-helper example snippets
use Doctrine\ORM\Mapping as ORM;
use Vrok\References\Entity\HasReferenceInterface;
use Vrok\References\Entity\HasReferenceTrait;
/**
* @ORM\Entity()
* @ORM\Table(name="sources")
*/
class Source implements HasReferenceInterface
{
use HasReferenceTrait;
/**
* @var array ['refName' => (bool)llable=false)
*/
protected $umn(type="integer")
*/
protected $id;
public function getId()
{
return $this->id;
}
}
use Vrok\References\Service\ReferenceHelper;
$refHelper = $services->get(ReferenceHelper::class);
$em = $services->get('Doctrine\ORM\EntityManager');
// the referenced object must have its identifiers (primary key columns) set,
// e.g. be already persisted when using autoincrement ID
$target = $em->getRepository(Target::class)->find(1);
$source = new Source();
$refHelper->setReferencedObject($source, '