public function setUp() { $this->storage = $this->createStorage(); $hydrator = new DefaultHydrator($this->storage); $this->schemaBuilder = new Schema\Builder("inventory"); $this->schemaBuilder->addType(new Schema\TypeSchema("product", ["sku" => new TextField(), "name" => new TextField()])); $this->registry = new MetadataAccessRegistry($this->storage, $this->schemaBuilder, $hydrator); $this->storage->alter($this->schemaBuilder->build()); }
public function setUp() { $this->storage = $this->createStorage(); $hydrator = new DefaultHydrator($this->storage); $this->schemaBuilder = new Schema\Builder("decimal"); $productSchema = new Schema\TypeSchema("test", ["without_default" => new DecimalField(null, true), "with_default" => new DecimalField(0.0), "with_integer" => new DecimalField(123.0), "with_float" => new DecimalField(123.456, false, ['precision' => 6, 'scale' => 3])]); $this->schemaBuilder->addType($productSchema); $this->registry = new MetadataAccessRegistry($this->storage, $this->schemaBuilder, $hydrator); $this->storage->alter($this->schemaBuilder->build()); }
public function setUp() { $this->storage = $this->createStorage(); $hydrator = new DefaultHydrator($this->storage); $this->schemaBuilder = new Schema\Builder("map"); $productSchema = new Schema\TypeSchema("test", ["without_default" => new MapField(), "with_default" => new MapField([])]); $this->schemaBuilder->addType($productSchema); $this->registry = new MetadataAccessRegistry($this->storage, $this->schemaBuilder, $hydrator); $this->storage->alter($this->schemaBuilder->build()); }
public function setUp() { $this->storage = $this->createStorage(); $hydrator = new DefaultHydrator($this->storage); $this->schemaBuilder = new Schema\Builder("association"); $categorySchema = new Schema\TypeSchema("category", ["name" => new TextField()]); $this->schemaBuilder->addType($categorySchema); $this->schemaBuilder->addType(new Schema\TypeSchema("product", ["category" => new AssociationField('association', $categorySchema, true)])); $this->registry = new MetadataAccessRegistry($this->storage, $this->schemaBuilder, $hydrator); $this->storage->alter($this->schemaBuilder->build()); }
public function setUp() { $this->defaultDate = new \DateTimeImmutable("2004-02-12T15:19:21+00:00"); $this->storage = $this->createStorage(); $hydrator = new DefaultHydrator($this->storage); $this->schemaBuilder = new Schema\Builder("date"); $productSchema = new Schema\TypeSchema("test", ["without_default" => new DateTimeField(null, true, [], 'Y-m-d H:i:s'), "with_default" => new DateTimeField($this->defaultDate, true, [], 'Y-m-d H:i:s')]); $this->schemaBuilder->addType($productSchema); $this->registry = new MetadataAccessRegistry($this->storage, $this->schemaBuilder, $hydrator); $this->storage->alter($this->schemaBuilder->build()); }