class Sequel::Model::Associations::AssociationReflection
AssociationReflection is a Hash subclass that keeps information on Sequel::Model associations. It provides methods to reduce internal code duplication. It should not be instantiated by the user.
Constants
- ASSOCIATION_DATASET_PROC
- FINALIZE_SETTINGS
Map of methods to cache keys used for finalizing associations.
Public Instance Methods
Name symbol for the _add internal association method
# File lib/sequel/model/associations.rb, line 35 def _add_method self[:_add_method] end
Name symbol for the _remove_all internal association method
# File lib/sequel/model/associations.rb, line 40 def _remove_all_method self[:_remove_all_method] end
Name symbol for the _remove internal association method
# File lib/sequel/model/associations.rb, line 45 def _remove_method self[:_remove_method] end
Name symbol for the _setter association method
# File lib/sequel/model/associations.rb, line 50 def _setter_method self[:_setter_method] end
Name symbol for the add association method
# File lib/sequel/model/associations.rb, line 55 def add_method self[:add_method] end
Apply all non-instance specific changes to the given dataset and return it.
# File lib/sequel/model/associations.rb, line 83 def apply_dataset_changes(ds) ds = ds.with_extend(AssociationDatasetMethods).clone(:association_reflection => self) if exts = self[:reverse_extend] ds = ds.with_extend(*exts) end ds = ds.select(*select) if select if c = self[:conditions] ds = (c.is_a?(Array) && !Sequel.condition_specifier?(c)) ? ds.where(*c) : ds.where(c) end ds = ds.order(*self[:order]) if self[:order] ds = ds.limit(*self[:limit]) if self[:limit] ds = ds.limit(1).skip_limit_check if limit_to_single_row? ds = ds.eager(self[:eager]) if self[:eager] ds = ds.distinct if self[:distinct] ds end
Use DISTINCT ON and ORDER BY clauses to limit the results to the first record with matching keys.
# File lib/sequel/model/associations.rb, line 137 def apply_distinct_on_eager_limit_strategy(ds) keys = predicate_key ds.distinct(*keys).order_prepend(*keys) end
Apply all non-instance specific changes and the eager_block option to the given dataset and return it.
# File lib/sequel/model/associations.rb, line 102 def apply_eager_dataset_changes(ds) ds = apply_dataset_changes(ds) if block = self[:eager_block] ds = block.call(ds) end ds end
Apply the eager graph limit strategy to the dataset to graph into the current dataset, or return the dataset unmodified if no SQL limit strategy is needed.
# File lib/sequel/model/associations.rb, line 112 def apply_eager_graph_limit_strategy(strategy, ds) case strategy when :distinct_on apply_distinct_on_eager_limit_strategy(ds.order_prepend(*self[:order])) when :window_function apply_window_function_eager_limit_strategy(ds.order_prepend(*self[:order])).select(*ds.columns) else ds end end
Apply an eager limit strategy to the dataset, or return the dataset unmodified if it doesn't need an eager limit strategy.
# File lib/sequel/model/associations.rb, line 125 def apply_eager_limit_strategy(ds, strategy=eager_limit_strategy, limit_and_offset=limit_and_offset()) case strategy when :distinct_on apply_distinct_on_eager_limit_strategy(ds) when :window_function apply_window_function_eager_limit_strategy(ds, limit_and_offset) else ds end end
If the ruby eager limit strategy is being used, slice the array using the slice range to return the object(s) at the correct offset/limit.
# File lib/sequel/model/associations.rb, line 164 def apply_ruby_eager_limit_strategy(rows, limit_and_offset = limit_and_offset()) name = self[:name] return unless range = slice_range(limit_and_offset) if returns_array? rows.each{|o| o.associations[name] = o.associations[name][range] || []} else offset = range.begin rows.each{|o| o.associations[name] = o.associations[name][offset]} end end
Use a window function to limit the results of the eager loading dataset.
# File lib/sequel/model/associations.rb, line 143 def apply_window_function_eager_limit_strategy(ds, limit_and_offset=limit_and_offset()) rn = ds.row_number_column limit, offset = limit_and_offset ds = ds.unordered.select_append{|o| o.row_number.function.over(:partition=>predicate_key, :order=>ds.opts[:order]).as(rn)}.from_self ds = ds.order(rn) if ds.db.database_type == :mysql ds = if !returns_array? ds.where(rn => offset ? offset+1 : 1) elsif offset offset += 1 if limit ds.where(rn => (offset...(offset+limit))) else ds.where{SQL::Identifier.new(rn) >= offset} end else ds.where{SQL::Identifier.new(rn) <= limit} end end
Whether the associations cache should use an array when storing the associated records during eager loading.
# File lib/sequel/model/associations.rb, line 177 def assign_singular? !returns_array? end
The class associated to the current model class via this association
# File lib/sequel/model/associations.rb, line 65 def associated_class cached_fetch(:class) do begin constantize(self[:class_name]) rescue NameError => e raise NameError, "#{e.message} (this happened when attempting to find the associated class for #{inspect})", e.backtrace end end end
The dataset associated via this association, with the non-instance specific changes already applied. This will be a joined dataset if the association requires joining tables.
# File lib/sequel/model/associations.rb, line 78 def associated_dataset cached_fetch(:_dataset){apply_dataset_changes(_associated_dataset)} end
Return an dataset that will load the appropriate associated objects for the given object using this association.
# File lib/sequel/model/associations.rb, line 214 def association_dataset_for(object) condition = if can_have_associated_objects?(object) predicate_keys.zip(predicate_key_values(object)) else false end associated_dataset.where(condition) end
Proc used to create the association dataset method.
# File lib/sequel/model/associations.rb, line 226 def association_dataset_proc ASSOCIATION_DATASET_PROC end
Name symbol for association method, the same as the name of the association.
# File lib/sequel/model/associations.rb, line 60 def association_method self[:name] end
Whether this association can have associated objects, given the current object. Should be false if obj cannot have associated objects because the necessary key columns are NULL.
# File lib/sequel/model/associations.rb, line 184 def can_have_associated_objects?(obj) true end
Whether you are able to clone from the given association type to the current association type, true by default only if the types match.
# File lib/sequel/model/associations.rb, line 190 def cloneable?(ref) ref[:type] == self[:type] end
Name symbol for the dataset association method
# File lib/sequel/model/associations.rb, line 195 def dataset_method self[:dataset_method] end
Whether the dataset needs a primary key to function, true by default.
# File lib/sequel/model/associations.rb, line 200 def dataset_need_primary_key? true end
Return the symbol used for the row number column if the window function eager limit strategy is being used, or nil otherwise.
# File lib/sequel/model/associations.rb, line 206 def delete_row_number_column(ds=associated_dataset) if eager_limit_strategy == :window_function ds.row_number_column end end
Whether to eagerly graph a lazy dataset, true by default. If this is false, the association won't respect the :eager_graph option when loading the association for a single record.
# File lib/sequel/model/associations.rb, line 353 def eager_graph_lazy_dataset? true end
The eager_graph limit strategy to use for this dataset
# File lib/sequel/model/associations.rb, line 231 def eager_graph_limit_strategy(strategy) if self[:limit] || !returns_array? strategy = strategy[self[:name]] if strategy.is_a?(Hash) case strategy when true true_eager_graph_limit_strategy when Symbol strategy else if returns_array? || offset :ruby end end end end
The eager limit strategy to use for this dataset.
# File lib/sequel/model/associations.rb, line 248 def eager_limit_strategy cached_fetch(:_eager_limit_strategy) do if self[:limit] || !returns_array? case s = cached_fetch(:eager_limit_strategy){default_eager_limit_strategy} when true true_eager_limit_strategy else s end end end end
Eager load the associated objects using the hash of eager options, yielding each row to the block.
# File lib/sequel/model/associations.rb, line 263 def eager_load_results(eo, &block) rows = eo[:rows] unless eo[:initialize_rows] == false Sequel.synchronize_with(eo[:mutex]){initialize_association_cache(rows)} end if eo[:id_map] ids = eo[:id_map].keys return ids if ids.empty? end strategy = eager_limit_strategy cascade = eo[:associations] eager_limit = nil if eo[:no_results] no_results = true elsif eo[:eager_block] || eo[:loader] == false || !use_placeholder_loader? ds = eager_loading_dataset(eo) strategy = ds.opts[:eager_limit_strategy] || strategy eager_limit = if el = ds.opts[:eager_limit] raise Error, "The :eager_limit dataset option is not supported for associations returning a single record" unless returns_array? strategy ||= true_eager_graph_limit_strategy if el.is_a?(Array) el else [el, nil] end else limit_and_offset end strategy = true_eager_graph_limit_strategy if strategy == :union # Correlated subqueries are not supported for regular eager loading strategy = :ruby if strategy == :correlated_subquery strategy = nil if strategy == :ruby && assign_singular? objects = apply_eager_limit_strategy(ds, strategy, eager_limit).all if strategy == :window_function delete_rn = ds.row_number_column objects.each{|obj| obj.values.delete(delete_rn)} end elsif strategy == :union objects = [] ds = associated_dataset loader = union_eager_loader joiner = " UNION ALL " ids.each_slice(subqueries_per_union).each do |slice| sql = loader.send(:sql_origin) join = false slice.each do |k| if join sql << joiner else join = true end loader.append_sql(sql, *k) end objects.concat(ds.with_sql(sql).to_a) end ds = ds.eager(cascade) if cascade ds.send(:post_load, objects) else loader = placeholder_eager_loader loader = loader.with_dataset{|dataset| dataset.eager(cascade)} if cascade objects = loader.all(ids) end Sequel.synchronize_with(eo[:mutex]){objects.each(&block)} unless no_results if strategy == :ruby apply_ruby_eager_limit_strategy(rows, eager_limit || limit_and_offset) end end
The key to use for the key hash when eager loading
# File lib/sequel/model/associations.rb, line 340 def eager_loader_key self[:eager_loader_key] end
By default associations do not need to select a key in an associated table to eagerly load.
# File lib/sequel/model/associations.rb, line 346 def eager_loading_use_associated_key? false end
Whether additional conditions should be added when using the filter by associations support.
# File lib/sequel/model/associations.rb, line 359 def filter_by_associations_add_conditions? self[:conditions] || self[:eager_block] || self[:limit] end
The expression to use for the additional conditions to be added for the filter by association support, when the association itself is filtered. Works by using a subquery to test that the objects passed also meet the association filter criteria.
# File lib/sequel/model/associations.rb, line 367 def filter_by_associations_conditions_expression(obj) ds = filter_by_associations_conditions_dataset.where(filter_by_associations_conditions_subquery_conditions(obj)) {filter_by_associations_conditions_key=>ds} end
Finalize the association by first attempting to populate the thread-safe cache, and then transfering the thread-safe cache value to the association itself, so that a mutex is not needed to get the value.
# File lib/sequel/model/associations.rb, line 375 def finalize return unless cache = self[:cache] finalizer = proc do |meth, key| next if has_key?(key) # Allow calling private methods to make sure caching is done appropriately send(meth) self[key] = cache.delete(key) if cache.has_key?(key) end finalize_settings.each(&finalizer) unless self[:instance_specific] finalizer.call(:associated_eager_dataset, :associated_eager_dataset) finalizer.call(:filter_by_associations_conditions_dataset, :filter_by_associations_conditions_dataset) end nil end
# File lib/sequel/model/associations.rb, line 406 def finalize_settings FINALIZE_SETTINGS end
Whether to handle silent modification failure when adding/removing associated records, false by default.
# File lib/sequel/model/associations.rb, line 412 def handle_silent_modification_failure? false end
Initialize the associations cache for the current association for the given objects.
# File lib/sequel/model/associations.rb, line 417 def initialize_association_cache(objects) name = self[:name] if assign_singular? objects.each{|object| object.associations[name] = nil} else objects.each{|object| object.associations[name] = []} end end
Show which type of reflection this is, and a guess at what code was used to create the association.
# File lib/sequel/model/associations.rb, line 428 def inspect o = self[:orig_opts].dup o.delete(:class) o.delete(:class_name) o.delete(:block) unless o[:block] o[:class] = self[:orig_class] if self[:orig_class] "#<#{self.class} #{self[:model]}.#{self[:type]} #{self[:name].inspect}#{", #{o.inspect[1...-1]}" unless o.empty?}>" end
The limit and offset for this association (returned as a two element array).
# File lib/sequel/model/associations.rb, line 439 def limit_and_offset if (v = self[:limit]).is_a?(Array) v else [v, nil] end end
Whether the associated object needs a primary key to be added/removed, false by default.
# File lib/sequel/model/associations.rb, line 449 def need_associated_primary_key? false end
A placeholder literalizer that can be used to lazily load the association. If one can't be used, returns nil.
# File lib/sequel/model/associations.rb, line 455 def placeholder_loader if use_placeholder_loader? cached_fetch(:placeholder_loader) do associated_dataset.placeholder_literalizer_loader do |pl, ds| ds = ds.where(Sequel.&(*predicate_keys.map{|k| SQL::BooleanExpression.new(:'=', k, pl.arg)})) if self[:block] ds = self[:block].call(ds) end ds end end end end
The values that #predicate_keys should match for objects to be associated.
# File lib/sequel/model/associations.rb, line 475 def predicate_key_values(object) predicate_key_methods.map{|k| object.get_column_value(k)} end
The keys to use for loading of the regular dataset, as an array.
# File lib/sequel/model/associations.rb, line 470 def predicate_keys cached_fetch(:predicate_keys){Array(predicate_key)} end
Qualify col
with the given table name.
# File lib/sequel/model/associations.rb, line 480 def qualify(table, col) transform(col) do |k| case k when Symbol, SQL::Identifier SQL::QualifiedIdentifier.new(table, k) else Sequel::Qualifier.new(table).transform(k) end end end
Qualify col with the associated model's table name.
# File lib/sequel/model/associations.rb, line 492 def qualify_assoc(col) qualify(associated_class.table_name, col) end
Qualify col with the current model's table name.
# File lib/sequel/model/associations.rb, line 497 def qualify_cur(col) qualify(self[:model].table_name, col) end
Returns the reciprocal association variable, if one exists. The reciprocal association is the association in the associated class that is the opposite of the current association. For example, Album.many_to_one :artist and Artist.one_to_many :albums are reciprocal associations. This information is to populate reciprocal associations. For example, when you do this_artist.add_album(album) it sets album.artist to this_artist.
# File lib/sequel/model/associations.rb, line 507 def reciprocal cached_fetch(:reciprocal) do possible_recips = [] associated_class.all_association_reflections.each do |assoc_reflect| if reciprocal_association?(assoc_reflect) possible_recips << assoc_reflect end end if possible_recips.length == 1 cached_set(:reciprocal_type, possible_recips.first[:type]) if ambiguous_reciprocal_type? possible_recips.first[:name] end end end
Whether the reciprocal of this association returns an array of objects instead of a single object, true by default.
# File lib/sequel/model/associations.rb, line 526 def reciprocal_array? true end
Name symbol for the remove_all_ association method
# File lib/sequel/model/associations.rb, line 531 def remove_all_method self[:remove_all_method] end
Whether associated objects need to be removed from the association before being destroyed in order to preserve referential integrity.
# File lib/sequel/model/associations.rb, line 537 def remove_before_destroy? true end
Name symbol for the remove_ association method
# File lib/sequel/model/associations.rb, line 542 def remove_method self[:remove_method] end
Whether to check that an object to be disassociated is already associated to this object, false by default.
# File lib/sequel/model/associations.rb, line 547 def remove_should_check_existing? false end
Whether this association returns an array of objects instead of a single object, true by default.
# File lib/sequel/model/associations.rb, line 553 def returns_array? true end
The columns to select when loading the association.
# File lib/sequel/model/associations.rb, line 558 def select self[:select] end
Whether to set the reciprocal association to self when loading associated records, false by default.
# File lib/sequel/model/associations.rb, line 564 def set_reciprocal_to_self? false end
Name symbol for the setter association method
# File lib/sequel/model/associations.rb, line 569 def setter_method self[:setter_method] end
The range used for slicing when using the :ruby eager limit strategy.
# File lib/sequel/model/associations.rb, line 574 def slice_range(limit_and_offset = limit_and_offset()) limit, offset = limit_and_offset if limit || offset (offset||0)..(limit ? (offset||0)+limit-1 : -1) end end
Private Instance Methods
The base dataset used for the association, before any order/conditions options have been applied.
# File lib/sequel/model/associations.rb, line 604 def _associated_dataset associated_class.dataset end
Whether for the reciprocal type for the given association cannot be known in advantage, false by default.
# File lib/sequel/model/associations.rb, line 610 def ambiguous_reciprocal_type? false end
Apply a distinct on eager limit strategy using IN with a subquery that uses DISTINCT ON to ensure only the first matching record for each key is included.
# File lib/sequel/model/associations.rb, line 630 def apply_filter_by_associations_distinct_on_limit_strategy(ds) k = filter_by_associations_limit_key ds.where(k=>apply_distinct_on_eager_limit_strategy(associated_eager_dataset.select(*k))) end
Apply a limit strategy to the given dataset so that filter by associations works with a limited dataset.
# File lib/sequel/model/associations.rb, line 616 def apply_filter_by_associations_limit_strategy(ds) case filter_by_associations_limit_strategy when :distinct_on apply_filter_by_associations_distinct_on_limit_strategy(ds) when :window_function apply_filter_by_associations_window_function_limit_strategy(ds) else ds end end
Apply a distinct on eager limit strategy using IN with a subquery that uses a filter on the row_number window function to ensure that only rows inside the limit are returned.
# File lib/sequel/model/associations.rb, line 638 def apply_filter_by_associations_window_function_limit_strategy(ds) ds.where(filter_by_associations_limit_key=>apply_window_function_eager_limit_strategy(associated_eager_dataset.select(*filter_by_associations_limit_alias_key)).select(*filter_by_associations_limit_aliases)) end
The #associated_dataset with the eager_block callback already applied.
# File lib/sequel/model/associations.rb, line 643 def associated_eager_dataset cached_fetch(:associated_eager_dataset) do ds = associated_dataset.unlimited if block = self[:eager_block] ds = block.call(ds) end ds end end
If the key exists in the reflection hash, return it. If the key doesn't exist and association reflections are uncached, then yield to get the value. If the key doesn't exist and association reflection are cached, check the cache and return the value if present, or yield to get the value, cache the value, and return it.
# File lib/sequel/model/associations.rb, line 587 def cached_fetch(key) fetch(key) do return yield unless h = self[:cache] Sequel.synchronize{return h[key] if h.has_key?(key)} value = yield Sequel.synchronize{h[key] = value} end end
Cache the value at the given key if caching.
# File lib/sequel/model/associations.rb, line 597 def cached_set(key, value) return unless h = self[:cache] Sequel.synchronize{h[key] = value} end
The default eager limit strategy to use for this association
# File lib/sequel/model/associations.rb, line 680 def default_eager_limit_strategy self[:model].default_eager_limit_strategy || :ruby end
The dataset to use for eager loading associated objects for multiple current objects, given the hash passed to the eager loader.
# File lib/sequel/model/associations.rb, line 655 def eager_loading_dataset(eo=OPTS) ds = eo[:dataset] || associated_eager_dataset ds = eager_loading_set_predicate_condition(ds, eo) if associations = eo[:associations] ds = ds.eager(associations) end if block = eo[:eager_block] orig_ds = ds ds = block.call(ds) end if eager_loading_use_associated_key? ds = if ds.opts[:eager_graph] && !orig_ds.opts[:eager_graph] block.call(orig_ds.select_append(*associated_key_array)) else ds.select_append(*associated_key_array) end end if self[:eager_graph] raise(Error, "cannot eagerly load a #{self[:type]} association that uses :eager_graph") if eager_loading_use_associated_key? ds = ds.eager_graph(self[:eager_graph]) end ds end
The predicate condition to use for the eager_loader.
# File lib/sequel/model/associations.rb, line 694 def eager_loading_predicate_condition(keys) {predicate_key=>keys} end
Set the predicate condition for the eager loading dataset based on the id map in the eager loading options.
# File lib/sequel/model/associations.rb, line 686 def eager_loading_set_predicate_condition(ds, eo) if id_map = eo[:id_map] ds = ds.where(eager_loading_predicate_condition(id_map.keys)) end ds end
Add conditions to the dataset to not include NULL values for the associated keys, and select those keys.
# File lib/sequel/model/associations.rb, line 700 def filter_by_associations_add_conditions_dataset_filter(ds) k = filter_by_associations_conditions_associated_keys ds.select(*k).where(Sequel.negate(k.zip([]))) end
The base dataset to use for the filter by associations conditions subquery, regardless of the objects that are passed in as filter values.
# File lib/sequel/model/associations.rb, line 723 def filter_by_associations_conditions_dataset cached_fetch(:filter_by_associations_conditions_dataset) do ds = associated_eager_dataset.unordered ds = filter_by_associations_add_conditions_dataset_filter(ds) ds = apply_filter_by_associations_limit_strategy(ds) ds end end
The conditions to add to the filter by associations conditions subquery to restrict it to to the object(s) that was used as the filter value.
# File lib/sequel/model/associations.rb, line 708 def filter_by_associations_conditions_subquery_conditions(obj) key = qualify(associated_class.table_name, associated_class.primary_key) case obj when Array {key=>obj.map(&:pk)} when Sequel::Dataset {key=>obj.select(*Array(qualify(associated_class.table_name, associated_class.primary_key)))} else Array(key).zip(Array(obj.pk)) end end
The strategy to use to filter by a limited association
# File lib/sequel/model/associations.rb, line 733 def filter_by_associations_limit_strategy v = fetch(:filter_limit_strategy, self[:eager_limit_strategy]) if v || self[:limit] || !returns_array? case v ||= self[:model].default_eager_limit_strategy when true, :union, :ruby # Can't use a union or ruby-based strategy for filtering by associations, switch to default eager graph limit # strategy. true_eager_graph_limit_strategy when Symbol v end end end
Whether to limit the associated dataset to a single row.
# File lib/sequel/model/associations.rb, line 748 def limit_to_single_row? !returns_array? end
Any offset to use for this association (or nil if there is no offset).
# File lib/sequel/model/associations.rb, line 753 def offset limit_and_offset.last end
A placeholder literalizer used to speed up eager loading.
# File lib/sequel/model/associations.rb, line 758 def placeholder_eager_loader cached_fetch(:placeholder_eager_loader) do eager_loading_dataset.placeholder_literalizer_loader do |pl, ds| apply_eager_limit_strategy(ds.where(predicate_key=>pl.arg), eager_limit_strategy) end end end
The reciprocal type as an array, should be overridden in reflection subclasses that have ambiguous reciprocal types.
# File lib/sequel/model/associations.rb, line 768 def possible_reciprocal_types [reciprocal_type] end
Whether the given association reflection is possible reciprocal association for the current association reflection.
# File lib/sequel/model/associations.rb, line 774 def reciprocal_association?(assoc_reflect) possible_reciprocal_types.include?(assoc_reflect[:type]) && (begin; assoc_reflect.associated_class; rescue NameError; end) == self[:model] && assoc_reflect[:conditions].nil? && assoc_reflect[:block].nil? end
The number of subqueries to use in each union query, used to eagerly load limited associations. Defaults to 40, the optimal number depends on the latency between the database and the application.
# File lib/sequel/model/associations.rb, line 784 def subqueries_per_union self[:subqueries_per_union] || 40 end
If s
is an array, map s
over the block.
Otherwise, just call the block with s
.
# File lib/sequel/model/associations.rb, line 790 def transform(s, &block) s.is_a?(Array) ? s.map(&block) : (yield s) end
The eager_graph limit strategy used when true is given as the value, choosing the best strategy based on what the database supports.
# File lib/sequel/model/associations.rb, line 808 def true_eager_graph_limit_strategy if associated_class.dataset.supports_window_functions? :window_function else :ruby end end
What eager limit strategy should be used when true is given as the value, defaults to UNION as that is the fastest strategy if the appropriate keys are indexed.
# File lib/sequel/model/associations.rb, line 796 def true_eager_limit_strategy if self[:eager_graph] || (offset && !associated_dataset.supports_offsets_in_correlated_subqueries?) # An SQL-based approach won't work if you are also eager graphing, # so use a ruby based approach in that case. :ruby else :union end end
A placeholder literalizer used to speed up the creation of union queries when eager loading a limited association.
# File lib/sequel/model/associations.rb, line 818 def union_eager_loader cached_fetch(:union_eager_loader) do associated_dataset.placeholder_literalizer_loader do |pl, ds| ds = self[:eager_block].call(ds) if self[:eager_block] keys = predicate_keys ds = ds.where(keys.map{pl.arg}.zip(keys)) if eager_loading_use_associated_key? ds = ds.select_append(*associated_key_array) end ds.from_self end end end
Whether the placeholder loader can be used to load the association.
# File lib/sequel/model/associations.rb, line 833 def use_placeholder_loader? self[:use_placeholder_loader] && _associated_dataset.supports_placeholder_literalizer? end