Permalink
Browse files

rename Proxy to Lazy; these were never wrappers around the 'real' obj…

…ects
  • Loading branch information...
1 parent 7b8cf1d commit cc40ecf569a772a8aa317d088f166ef385fe0d04 @pmjones pmjones committed Nov 28, 2012
View
@@ -6,10 +6,10 @@
require __DIR__ . '/src/Aura/Marshal/Collection/GenericCollection.php';
require __DIR__ . '/src/Aura/Marshal/Exception.php';
require __DIR__ . '/src/Aura/Marshal/Manager.php';
-require __DIR__ . '/src/Aura/Marshal/Proxy/BuilderInterface.php';
-require __DIR__ . '/src/Aura/Marshal/Proxy/Builder.php';
-require __DIR__ . '/src/Aura/Marshal/Proxy/ProxyInterface.php';
-require __DIR__ . '/src/Aura/Marshal/Proxy/GenericProxy.php';
+require __DIR__ . '/src/Aura/Marshal/Lazy/BuilderInterface.php';
+require __DIR__ . '/src/Aura/Marshal/Lazy/Builder.php';
+require __DIR__ . '/src/Aura/Marshal/Lazy/LazyInterface.php';
+require __DIR__ . '/src/Aura/Marshal/Lazy/GenericLazy.php';
require __DIR__ . '/src/Aura/Marshal/Entity/MagicArrayAccessTrait.php';
require __DIR__ . '/src/Aura/Marshal/Entity/MagicPropertyTrait.php';
require __DIR__ . '/src/Aura/Marshal/Entity/BuilderInterface.php';
@@ -11,7 +11,7 @@
namespace Aura\Marshal\Entity;
use Aura\Marshal\Type\GenericType;
-use Aura\Marshal\Proxy\BuilderInterface as ProxyBuilderInterface;
+use Aura\Marshal\Lazy\BuilderInterface as LazyBuilderInterface;
/**
*
@@ -10,7 +10,7 @@
*/
namespace Aura\Marshal\Entity;
-use Aura\Marshal\Proxy\ProxyInterface;
+use Aura\Marshal\Lazy\LazyInterface;
/**
*
@@ -24,7 +24,7 @@
{
/**
*
- * Calls ArrayAccess::offsetGet() to get a field value; converts proxy
+ * Calls ArrayAccess::offsetGet() to get a field value; converts Lazy
* objects for related entites and collections in place.
*
* @param string $field The field name to get.
@@ -37,9 +37,9 @@ public function __get($field)
// get the field value
$value = $this->offsetGet($field);
- // is it a proxy for a related?
- if ($value instanceof ProxyInterface) {
- // replace the proxy value with the real value
+ // is it a Lazy placeholder?
+ if ($value instanceof LazyInterface) {
+ // replace the Lazy placeholder with the real object
$value = $value->get($this);
$this->offsetSet($field, $value);
}
@@ -10,7 +10,7 @@
*/
namespace Aura\Marshal\Entity;
-use Aura\Marshal\Proxy\ProxyInterface;
+use Aura\Marshal\Lazy\LazyInterface;
/**
*
@@ -24,7 +24,7 @@
{
/**
*
- * Gets a protected property as a field value; converts proxy objects for
+ * Gets a protected property as a field value; converts Lazy objects for
* related entites and collections in place.
*
* Note that this will *not* be invoked by in-class uses of the protected
@@ -40,9 +40,9 @@ public function __get($field)
// get the property value
$value = $this->$field;
- // is it a proxy for a related?
- if ($value instanceof ProxyInterface) {
- // replace the proxy value with the real value
+ // is it a Lazy placeholder?
+ if ($value instanceof LazyInterface) {
+ // replace the Lazy placeholder with the real object
$value = $value->get($this);
$this->$field = $value;
}
@@ -8,13 +8,13 @@
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
-namespace Aura\Marshal\Proxy;
+namespace Aura\Marshal\Lazy;
use Aura\Marshal\Relation\RelationInterface;
/**
*
- * A builder for Proxy objects.
+ * A builder for Lazy objects.
*
* @package Aura.Marshal
*
@@ -28,16 +28,16 @@ class Builder implements BuilderInterface
* @var string
*
*/
- protected $class = 'Aura\Marshal\Proxy\GenericProxy';
+ protected $class = 'Aura\Marshal\Lazy\GenericLazy';
/**
*
- * Creates a new Proxy object.
+ * Creates a new Lazy object.
*
* @param RelationInterface $relation The relationship object between the
* native and foreign types.
*
- * @return Proxy
+ * @return Lazy
*
*/
public function newInstance(RelationInterface $relation)
@@ -8,13 +8,13 @@
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
-namespace Aura\Marshal\Proxy;
+namespace Aura\Marshal\Lazy;
use Aura\Marshal\Relation\RelationInterface;
/**
*
- * An interface for Proxy builders.
+ * An interface for Lazy builders.
*
* @package Aura.Marshal
*
@@ -23,12 +23,12 @@
{
/**
*
- * Creates a new Proxy object.
+ * Creates a new Lazy object.
*
* @param RelationInterface $relation The relationship object between the
* native and foreign types.
*
- * @return Proxy
+ * @return Lazy
*
*/
public function newInstance(RelationInterface $relation);
@@ -8,19 +8,19 @@
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
-namespace Aura\Marshal\Proxy;
+namespace Aura\Marshal\Lazy;
use Aura\Marshal\Relation\RelationInterface;
/**
*
- * A generic Proxy object, useful in cases when special functionality is not
+ * A generic Lazy object, useful in cases when special functionality is not
* needed.
*
* @package Aura.Marshal
*
*/
-class GenericProxy implements ProxyInterface
+class GenericLazy implements LazyInterface
{
/**
*
@@ -8,16 +8,16 @@
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
-namespace Aura\Marshal\Proxy;
+namespace Aura\Marshal\Lazy;
/**
*
- * An interface for Proxy objects.
+ * An interface for Lazy objects.
*
* @package Aura.Marshal
*
*/
-interface ProxyInterface
+interface LazyInterface
{
/**
*
@@ -13,7 +13,7 @@
use Aura\Marshal\Collection\Builder as CollectionBuilder;
use Aura\Marshal\Exception;
use Aura\Marshal\Entity\Builder as EntityBuilder;
-use Aura\Marshal\Proxy\Builder as ProxyBuilder;
+use Aura\Marshal\Lazy\Builder as LazyBuilder;
/**
*
@@ -53,7 +53,7 @@ public function newInstance($info)
'index_fields' => [],
'entity_builder' => null,
'collection_builder' => null,
- 'proxy_builder' => null,
+ 'lazy_builder' => null,
];
$info = array_merge($base, $info);
@@ -70,16 +70,16 @@ public function newInstance($info)
$info['collection_builder'] = new CollectionBuilder;
}
- if (! $info['proxy_builder']) {
- $info['proxy_builder'] = new ProxyBuilder;
+ if (! $info['lazy_builder']) {
+ $info['lazy_builder'] = new LazyBuilder;
}
$type = new GenericType;
$type->setIdentityField($info['identity_field']);
$type->setIndexFields($info['index_fields']);
$type->setEntityBuilder($info['entity_builder']);
$type->setCollectionBuilder($info['collection_builder']);
- $type->setProxyBuilder($info['proxy_builder']);
+ $type->setLazyBuilder($info['lazy_builder']);
return $type;
}
@@ -13,7 +13,7 @@
use Aura\Marshal\Collection\BuilderInterface as CollectionBuilderInterface;
use Aura\Marshal\Data;
use Aura\Marshal\Exception;
-use Aura\Marshal\Proxy\BuilderInterface as ProxyBuilderInterface;
+use Aura\Marshal\Lazy\BuilderInterface as LazyBuilderInterface;
use Aura\Marshal\Entity\BuilderInterface as EntityBuilderInterface;
use Aura\Marshal\Relation\RelationInterface;
use SplObjectStorage;
@@ -108,12 +108,12 @@ class GenericType extends Data
/**
*
- * A builder to create proxy objects.
+ * A builder to create Lazy objects.
*
- * @var ProxyBuilderInterface
+ * @var LazyBuilderInterface
*
*/
- protected $proxy_builder;
+ protected $lazy_builder;
/**
*
@@ -250,28 +250,28 @@ public function getCollectionBuilder()
/**
*
- * Sets the proxy builder to create proxy objects.
+ * Sets the lazy builder to create lazy objects.
*
- * @param ProxyBuilderInterface $builder The proxy builder.
+ * @param LazyBuilderInterface $builder The lazy builder.
*
* @return void
*
*/
- public function setProxyBuilder(ProxyBuilderInterface $proxy_builder)
+ public function setLazyBuilder(LazyBuilderInterface $lazy_builder)
{
- $this->proxy_builder = $proxy_builder;
+ $this->lazy_builder = $lazy_builder;
}
/**
*
- * Returns the proxy builder that creates proxy objects.
+ * Returns the lazy builder that creates lazy objects.
*
- * @return ProxyBuilderInterface
+ * @return LazyBuilderInterface
*
*/
- public function getProxyBuilder()
+ public function getLazyBuilder()
{
- return $this->proxy_builder;
+ return $this->lazy_builder;
}
/**
@@ -438,7 +438,7 @@ protected function loadData(
// set related fields
foreach ($this->getRelations() as $field => $relation) {
- $entity->$field = $this->proxy_builder->newInstance($relation);
+ $entity->$field = $this->lazy_builder->newInstance($relation);
}
// done! return the new offset number.
@@ -4,7 +4,7 @@
use Aura\Marshal\Type\GenericType;
use Aura\Marshal\Entity\Builder as EntityBuilder;
use Aura\Marshal\Collection\Builder as CollectionBuilder;
-use Aura\Marshal\Proxy\Builder as ProxyBuilder;
+use Aura\Marshal\Lazy\Builder as LazyBuilder;
/**
* Test class for Collection.
@@ -5,8 +5,8 @@
use Aura\Marshal\MockEntity;
use Aura\Marshal\Entity\Builder;
use Aura\Marshal\MockEntityBuilder;
-use Aura\Marshal\Proxy\Builder as ProxyBuilder;
-use Aura\Marshal\Proxy\GenericProxy;
+use Aura\Marshal\Lazy\Builder as LazyBuilder;
+use Aura\Marshal\Lazy\GenericLazy;
/**
* Test class for Entity.
@@ -20,7 +20,7 @@ protected function getData()
'foo' => 'bar',
'baz' => 'dim',
'zim' => 'gir',
- 'related' => new GenericProxy(new MockRelation),
+ 'related' => new GenericLazy(new MockRelation),
];
}
@@ -2,7 +2,7 @@
namespace Aura\Marshal;
use Aura\Marshal\Relation\Builder as RelationBuilder;
use Aura\Marshal\Type\Builder as TypeBuilder;
-use Aura\Marshal\Proxy\Builder as ProxyBuilder;
+use Aura\Marshal\Lazy\Builder as LazyBuilder;
/**
* Test class for Manager.
@@ -8,7 +8,7 @@
use Aura\Marshal\Relation\Builder as RelationBuilder;
use Aura\Marshal\Type\Builder as TypeBuilder;
use Aura\Marshal\Type\GenericType;
-use Aura\Marshal\Proxy\Builder as ProxyBuilder;
+use Aura\Marshal\Lazy\Builder as LazyBuilder;
/**
* Test class for Type.
@@ -35,7 +35,7 @@ protected function setUp()
$this->type = new GenericType;
$this->type->setIdentityField($info['identity_field']);
$this->type->setIndexFields($info['index_fields']);
- $this->type->setEntityBuilder(new EntityBuilder(new ProxyBuilder));
+ $this->type->setEntityBuilder(new EntityBuilder(new LazyBuilder));
$this->type->setCollectionBuilder(new CollectionBuilder);
}
@@ -87,11 +87,11 @@ public function testSetAndGetCollectionBuilder()
$this->assertSame($builder, $actual);
}
- public function testSetAndGetProxyBuilder()
+ public function testSetAndGetLazyBuilder()
{
- $builder = new ProxyBuilder;
- $this->type->setProxyBuilder($builder);
- $actual = $this->type->getProxyBuilder();
+ $builder = new LazyBuilder;
+ $this->type->setLazyBuilder($builder);
+ $actual = $this->type->getLazyBuilder();
$this->assertSame($builder, $actual);
}

0 comments on commit cc40ecf

Please sign in to comment.