Exemplo n.º 1
0
 /**
  * Update ORM records schema, synchronize declared and database schemas and return instance of
  * SchemaBuilder.
  *
  * @param SchemaBuilder $builder User specified schema builder.
  * @return SchemaBuilder
  */
 public function updateSchema(SchemaBuilder $builder = null)
 {
     $builder = !empty($builder) ? $builder : $this->schemaBuilder();
     //Casting relations between records
     $builder->castRelations();
     //Create all required tables and columns
     $builder->synchronizeSchema();
     //Saving
     $this->memory->saveData(static::SCHEMA_SECTION, $this->schema = $builder->normalizeSchema());
     //Let's reinitialize records
     DataEntity::resetInitiated();
     return $builder;
 }
Exemplo n.º 2
0
 /**
  * Update ORM records schema, synchronize declared and database schemas and return instance of
  * SchemaBuilder.
  *
  * @param SchemaBuilder $builder    User specified schema builder.
  * @param bool          $syncronize Create all required tables and columns
  * @return SchemaBuilder
  */
 public function updateSchema(SchemaBuilder $builder = null, $syncronize = false)
 {
     if (empty($builder)) {
         $builder = $this->schemaBuilder();
     }
     //Create all required tables and columns
     if ($syncronize) {
         $builder->synchronizeSchema();
     }
     //Getting normalized (cached) version of schema
     $this->schema = $builder->normalizeSchema();
     //Saving
     $this->memory->saveData(static::MEMORY, $this->schema);
     //Let's reinitialize records
     DataEntity::resetInitiated();
     return $builder;
 }
Exemplo n.º 3
0
 /**
  * Update ODM documents schema and return instance of SchemaBuilder.
  *
  * @param SchemaBuilder $builder User specified schema builder.
  * @return SchemaBuilder
  */
 public function updateSchema(SchemaBuilder $builder = null)
 {
     $builder = !empty($builder) ? $builder : $this->schemaBuilder();
     //We will create all required indexes now
     $builder->createIndexes();
     //Saving
     $this->memory->saveData(static::SCHEMA_SECTION, $this->schema = $builder->normalizeSchema());
     //Let's reinitialize models
     DataEntity::resetInitiated();
     return $builder;
 }
Exemplo n.º 4
0
 /**
  * Update ODM documents schema and return instance of SchemaBuilder.
  *
  * @param SchemaBuilder $builder User specified schema builder.
  * @param bool          $createIndexes
  * @return SchemaBuilder
  */
 public function updateSchema(SchemaBuilder $builder = null, $createIndexes = false)
 {
     if (empty($builder)) {
         $builder = $this->schemaBuilder();
     }
     //We will create all required indexes now
     if ($createIndexes) {
         $builder->createIndexes();
     }
     //Getting cached/normalized schema
     $this->schema = $builder->normalizeSchema();
     //Saving
     $this->memory->saveData(static::MEMORY, $this->schema);
     //Let's reinitialize models
     DataEntity::resetInitiated();
     return $builder;
 }