Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions projects/tutorial_slim_php_2017/HealthProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Custom\Entity;

use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="HealthProfile")
* @ORM\Entity
*/

class HealthProfile
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="\Custom\Entity\Person", inversedBy="healthProfile",cascade={"remove"})
* @ORM\JoinColumn(name="person_id", referencedColumnName="id")
*/
protected $person;
/**
* @ORM\Column(name="weight", type="decimal")
*/
private $weight;
/**
* @ORM\Column(name="height", type="decimal")
*/
private $height;
/**
* @ORM\Column(name="date", type="date")
*/
private $date;

public function setPerson(\Custom\Entity\Person $p) {
$this->person = p;
}

public function __get($property)
{
if (property_exists($this, $property)) {
return $this->$property;
}
}
public function __set($property, $value)
{
if (property_exists($this, $property)) {
$this->$property = $value;
}
}
}
71 changes: 71 additions & 0 deletions projects/tutorial_slim_php_2017/Person.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

namespace Custom\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
* Person
* @ORM\Table(name="Person")
* @ORM\Entity
*/
class Person

{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="\Custom\Entity\HealthProfile", mappedBy="person")
*/
protected $healthProfile;
/**
* @ORM\Column(name="firstName", type="string", length=255)
*/
private $firstName;
/**
* @ORM\Column(name="lastName", type="string", length=255)
*/
private $lastName;
/**
* @ORM\Column(name="birthDate", type="date")
*/
private $birthDate;



public function addHealthProfile(\Custom\Entity\HealthProfile $hp){
$this->healthProfile[] = $hp;
}

public function getLastHealthProfile() {

}

public function __construct() {
$this->healthProfile = new ArrayCollection();
}

public
function __get($property)
{
if (property_exists($this, $property))
{
return $this->$property;
}
}

public

function __set($property, $value)
{
if (property_exists($this, $property))
{
$this->$property = $value;
}
}
}
Loading