Ejemplo n.º 1
0
 /**
  * 
  * @return array
  */
 public function __toArray()
 {
     $returnArray = parent::__toArray();
     if (isset($returnArray['data'])) {
         foreach ($returnArray['data'] as $index => $item) {
             $returnArray['data'][$index] = Factory::create(json_encode($item))->__toArray();
         }
     }
     return $returnArray;
 }
Ejemplo n.º 2
0
 public function __construct($json)
 {
     parent::__construct($json);
     $this->setDataProperty('object', ObjectFactory::create(json_encode($this->getDataProperty('object'))));
     if ($this->hasPreviousAttributes()) {
         $previousAttributesCollection = new ArrayCollection();
         foreach ($this->getPreviousAttributes() as $key => $value) {
             if ($value instanceof \stdClass && isset($value->object) && ObjectFactory::isKnownEntityType($value->object)) {
                 $value = ObjectFactory::create(json_encode($value));
             }
             $previousAttributesCollection->set($key, $value);
         }
         $this->setDataProperty('previous_attributes', $previousAttributesCollection);
     }
 }
Ejemplo n.º 3
0
 public function setUp()
 {
     $this->setTestFixturePath(get_class($this));
     $this->object = Factory::create($this->getFixture('object.json'));
 }
Ejemplo n.º 4
0
 public function testDiscount()
 {
     $this->assertInstanceOf('webignition\\Model\\Stripe\\Discount', Factory::create($this->getFixture('Discount/discount.json')));
 }