Skip to content

Commit

Permalink
Attach the Sprig object to the Field object for cross referencing
Browse files Browse the repository at this point in the history
  • Loading branch information
Woody Gilk committed Mar 13, 2010
1 parent 93c4184 commit 66f612c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions classes/sprig/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ protected function __construct()

foreach ($this->_fields as $name => $field)
{
// Assign this model to the field
$field->object = $this;

if ($field instanceof Sprig_Field_ForeignKey AND ! $field->model)
{
if ($field instanceof Sprig_Field_HasMany)
Expand Down
5 changes: 5 additions & 0 deletions classes/sprig/field/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ abstract class Sprig_Field_Core {
*/
public $callbacks = array();

/**
* @var object {@link Sprig} model parent
*/
public $object;

public function __construct(array $options = NULL)
{
if ( ! empty($options))
Expand Down

0 comments on commit 66f612c

Please sign in to comment.