start a restructure

This commit is contained in:
Antonio Spinelli
2014-03-21 18:03:44 -03:00
parent b0b0d4a1a4
commit e59d70a0ac
180 changed files with 21 additions and 16 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace DesignPatterns\Proxy;
/**
* Class RecordProxy
*/
class RecordProxy extends Record
{
/**
* @var bool
*/
protected $isDirty = false;
/**
* @var bool
*/
protected $isInitialized = false;
/**
* @param array $data
*/
public function __construct($data)
{
parent::__construct($data);
// when the record has data, mark it as initialized
// since Record will hold our business logic, we don't want to
// implement this behaviour there, but instead in a new proxy class
// that extends the Record class
if (null !== $data) {
$this->isInitialized = true;
$this->isDirty = true;
}
}
/**
* magic setter
*
* @param string $name
* @param mixed $value
*
* @return void
*/
public function __set($name, $value)
{
$this->isDirty = true;
parent::__set($name, $value);
}
}