Class: Foobara::Entity

Inherits:
DetachedEntity show all
Extended by:
NewPrepend
Includes:
Concerns::Attributes, Concerns::Callbacks, Concerns::Initialization, Concerns::Mutations, Concerns::Persistence, Concerns::Queries, Concerns::Transactions, Concerns::Types
Defined in:
foobara-0.0.110/projects/entity/lib/foobara/entity.rb,
foobara-0.0.110/projects/entity/src/entity.rb,
foobara-0.0.110/projects/entity/src/new_prepend.rb,
foobara-0.0.110/projects/entity/src/concerns/types.rb,
foobara-0.0.110/projects/entity/src/not_found_error.rb,
foobara-0.0.110/projects/entity/src/concerns/queries.rb,
foobara-0.0.110/projects/entity/src/concerns/callbacks.rb,
foobara-0.0.110/projects/entity/src/concerns/mutations.rb,
foobara-0.0.110/projects/entity/src/concerns/attributes.rb,
foobara-0.0.110/projects/entity/src/concerns/persistence.rb,
foobara-0.0.110/projects/entity/src/concerns/transactions.rb,
foobara-0.0.110/projects/entity/src/concerns/initialization.rb,
foobara-0.0.110/projects/entity/src/sensitive_type_removers/entity.rb,
foobara-0.0.110/projects/entity/src/sensitive_value_removers/entity.rb

Overview

TODO: I think we should have a configuration that indicates if created records can have primary keys past to them or not. That is, do primary keys get issued by the database upon insertion? Or are they generated externally and passed in? Would be nice to have programmatic clarification via explicit configuration.

Defined Under Namespace

Modules: Concerns, NewPrepend, SensitiveTypeRemovers, SensitiveValueRemovers Classes: NoCurrentTransactionError, NotFoundError

Instance Attribute Summary

Attributes included from Concerns::Persistence

#is_built, #is_created, #is_hard_deleted, #is_loaded, #is_persisted, #persisted_attributes

Attributes included from Concerns::Callbacks

#callback_registry

Attributes inherited from Model

#mutable

Class Method Summary collapse

Methods included from NewPrepend

__private_new__, new

Methods included from Concern

foobara_class_methods_module_for, foobara_concern?, included

Methods included from Concerns::Initialization

#build, #successfully_loaded

Methods included from Concerns::Persistence

#built?, #created?, #dirty?, #hard_delete!, #hard_delete_without_callbacks!, #hard_deleted?, #load_if_necessary!, #loaded?, #persisted?, #restore!, #restore_without_callbacks!, #save_persisted_attributes, #to_persisted_attributes, #unhard_delete!, #verify_not_hard_deleted!

Methods included from Concerns::Attributes

#read_attribute, #read_attribute!, #values_at, #with_changed_attribute_callbacks, #write_attribute, #write_attribute!, #write_attribute_without_callbacks, #write_attribute_without_callbacks!, #write_attributes, #write_attributes_without_callbacks

Methods included from Concerns::Mutations

#update, #update_aggregate

Methods included from Concerns::Callbacks

#fire, #initialize, #without_callbacks

Methods included from DetachedEntity::Concerns::Serialize

#inspect, #to_json

Methods included from DetachedEntity::Concerns::PrimaryKey

#primary_key

Methods included from DetachedEntity::Concerns::Equality

#==, #dup, #hash

Methods inherited from Model

#==, abstract, abstract?, attribute_names, #attributes, #attributes_with_delegates, #cast_attribute, #cast_attribute!, closest_namespace_module, description, domain, domain_name, #eql?, foobara_model_name, foobara_name, full_model_name, #hash, #initialize, organization_name, possible_errors, #read_attribute, #read_attribute!, subclass, #to_h, #to_json, #valid?, valid_attribute_name?, #validate!, validate_attribute_name!, #validation_errors, #write_attribute, #write_attribute!, #write_attributes, #write_attributes!

Class Method Details

.install!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'foobara-0.0.110/projects/entity/lib/foobara/entity.rb', line 9

def install!
  handler = TypeDeclarations::Handlers::ExtendEntityTypeDeclaration.new
  TypeDeclarations.register_type_declaration(handler)

  TypeDeclarations.register_sensitive_type_remover(SensitiveTypeRemovers::Entity.new(handler))
  TypeDeclarations.register_sensitive_value_remover(handler, SensitiveValueRemovers::Entity)

  detached_entity = Namespace.global.foobara_lookup_type!(:detached_entity)
  BuiltinTypes.build_and_register!(:entity, detached_entity, nil)

  DetachedEntityType.types_requiring_conversion << :entity
  DetachedEntityType.model_base_classes_requiring_conversion << "Foobara::Entity"
end

.reset_allObject



23
24
25
26
27
# File 'foobara-0.0.110/projects/entity/lib/foobara/entity.rb', line 23

def reset_all
  Entity::Concerns::Callbacks.reset_all

  install!
end