Beispiel #1
0
 function testObjectBinding()
 {
     $object = new Mock\MockPersistedObject();
     $model = $object->getModel();
     $model->bindTo($object, 'foo', function () {
         return 'bar';
     });
     $isBound = persistr\Object\Binding\Registry::isBound($object, 'foo');
     $this->assertEquals(true, $isBound);
 }
Beispiel #2
0
 /**
  * Helper method
  * Binds callable to specific object instance rather than whole model
  * @param object $object
  * @param string $attribute
  * @param callable $callable
  * @return persistr\Model\Blank
  */
 public function bindTo($object, $attribute, callable $callable = null)
 {
     persistr\Object\Binding\Registry::bindTo($object, $attribute, $callable);
     return $this;
 }