1: <?php
2:
3: namespace PHPixie\ORM\Relationships\Type\OneTo\Property\Query;
4:
5: abstract class Single extends \PHPixie\ORM\Relationships\Type\OneTo\Property\Query
6: {
7: public function set($value)
8: {
9: if($value === null || $value->isDeleted())
10: return $this->remove();
11:
12: $plan = $this->linkPlan($value);
13: $plan->execute();
14: $this->resetProperties($value);
15: return $this;
16: }
17:
18: public function remove()
19: {
20: $plan = $this->unlinkPlan();
21: $plan->execute();
22: return $this;
23: }
24:
25: protected abstract function linkPlan($value);
26: protected abstract function resetProperties($value);
27: protected abstract function unlinkPlan();
28: }