Class ActiveRecord_Association_HasOne

Description

Implements the has_one association

Located in /activerecord/lib/ActiveRecord/Association/HasOne.php (line 9)

ActiveRecord_Association
   |
   --ActiveRecord_Association_HasOne
Variable Summary
 static mixed $creation_options
 mixed $primary_key
Method Summary
 ActiveRecord_Association_HasOne __construct (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, string $name, array $options)
 void after_create ( $record)
 void after_save ( $record)
 ActiveRecord_Base build_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, array $attributes)
 void do_include ( &$results, array $results)
 ActiveRecord_Base get_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, [boolean $force_reload = false])
 void set_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, object $value, [boolean $skipKeyUpdates = false])
Variables
static mixed $creation_options = array('class_name'=>1, 'foreign_key'=>1, 'primary_key'=>1) (line 14)

List of valid options for creation

  • access: public
mixed $primary_key (line 16)
  • access: protected

Inherited Variables

Inherited from ActiveRecord_Association

ActiveRecord_Association::$class_name
ActiveRecord_Association::$foreign_key
ActiveRecord_Association::$name
Methods
Constructor __construct (line 26)

Constructor

  • access: public
ActiveRecord_Association_HasOne __construct (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, string $name, array $options)
  • ActiveRecord_Base $record: An instance of the class the association is being added to
  • ActiveRecord_Proxy $proxy: A proxy for the class to allow limited access to protected methods
  • string $name: The association name
  • array $options: Options for the association
after_create (line 107)

Check the associate to make sure it has been saved

  • access: public
void after_create ( $record)
  • $record
after_save (line 121)

Check the associate to make sure it has been saved

  • access: public
void after_save ( $record)
  • $record
build_associate (line 138)

Build a new associated object from an associative array of attributes and assign it to the object

  • access: public
ActiveRecord_Base build_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, array $attributes)
  • ActiveRecord_Base $record: An instance of the class the association is being added to
  • ActiveRecord_Proxy $proxy: A proxy for the class to allow limited access to protected methods
  • array $attributes: The attributes for the new object to associate with our record
create_associate (line 161)

Create and save a new associated object from an associative array of attributes and assign it to the object

  • access: public
ActiveRecord_Base create_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, array $attributes)
  • ActiveRecord_Base $record: An instance of the class the association is being added to
  • ActiveRecord_Proxy $proxy: A proxy for the class to allow limited access to protected methods
  • array $attributes: The attributes for the new object to associate with our record
do_include (line 181)

Implements the 'include' behavior for a find operation

  • access: public
void do_include ( &$results, array $results)
  • array $results: The result set to process
  • &$results

Redefinition of:
ActiveRecord_Association::do_include()
Implements the 'include' behavior for a find operation
get_associate (line 56)

Accessor method for the associated object

  • return: The associated object or null
  • access: public
ActiveRecord_Base get_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, [boolean $force_reload = false])
  • ActiveRecord_Base $record: An instance of the class the association is being added to
  • ActiveRecord_Proxy $proxy: A proxy for the class to allow limited access to protected methods
  • boolean $force_reload: If true, forces reloading of the object even if it's cached
set_associate (line 76)

Mutator method for the associated object

  • access: public
void set_associate (ActiveRecord_Base $record, ActiveRecord_Proxy $proxy, object $value, [boolean $skipKeyUpdates = false])
  • ActiveRecord_Base $record: An instance of the class the association is being added to
  • ActiveRecord_Proxy $proxy: A proxy for the class to allow limited access to protected methods
  • object $value: The new object to associate with our record
  • boolean $skipKeyUpdates: This flag exists for include operations assigning associated objects for caching. When this flag is true, the normal foreign key assignment and update steps are skipped and the object is merely placed in the cache.

Inherited Methods

Inherited From ActiveRecord_Association

 ActiveRecord_Association::class_name()
 ActiveRecord_Association::do_include()
 ActiveRecord_Association::foreign_key()
 ActiveRecord_Association::name()

Documentation generated on Wed, 25 Apr 2012 09:46:43 -0700 by phpDocumentor 1.4.3