- print_r: documentation ( source)
<?php
class Builder
{
/** @Column(type="string") */
protected $id;
/** @Column(type="string") */
protected $name;
/** @ManyToOne(targetEntity="User")
* @JoinColumn(name="created_by", referencedColumnName="id")
*/
protected $created_by;
/** @ManyToOne(targetEntity="User")
* @JoinColumn(name="updated_by", referencedColumnName="id")
*/
protected $updated_by;
public function __construct(array $input)
{
$this->id = $input['id'];
$this->name = $input['name'];
$this->created_by = $input['created_by'];
$this->updated_by = $input['updated_by'];
}
}
class User
{
/** @Column(type="string") */
protected $id;
/** @Column(type="string") */
protected $name;
public function __construct(array $input)
{
$this->id = $input['id'];
$this->name = $input['name'];
}
}
$input = [];
$input['id'] = 1;
$input['name'] = 'TEST';
$input['created_by'] = new User(['id' => 1, 'name' => 'User']);
$input['updated_by'] = new User(['id' => 1, 'name' => 'User']);
$builder = new Builder($input);
print_r($builder);