SchemaTable.fromEntity constructor Null safety

SchemaTable.fromEntity(
  1. ManagedEntity entity
)

Creates an instance of this type to mirror entity.

Implementation

SchemaTable.fromEntity(ManagedEntity entity) {
  name = entity.tableName;

  final validProperties = entity.properties.values
      .where(
        (p) =>
            (p is ManagedAttributeDescription && !p.isTransient) ||
            (p is ManagedRelationshipDescription &&
                p.relationshipType == ManagedRelationshipType.belongsTo),
      )
      .toList();

  _columns =
      validProperties.map((p) => SchemaColumn.fromProperty(p!)).toList();

  uniqueColumnSet = entity.uniquePropertySet?.map((p) => p!.name).toList();
}