Jump to content

Help WIth Object


refiking

Recommended Posts

Ok. So, I'm trying to retrieve the id value from an object.  Here is the code I have that works so far:

$object = 'object';
$koid = $this->$object;
echo '<pre>'; print_r($koid); echo '</pre>';

 

and this is what is returns:

Order Object
(
    [id:protected] => 5
    [stand_by:protected] => test
    [problem:protected] => test
)

 

what do I need to do to make $koid equal the id value (5 in this case)?

Link to comment
Share on other sites

ohhhh..sorry :)

<?
class OrderForm extends BaseOrderForm
{ 

  static protected $choices = array(1 => 'OPEN',2	=> 'CLOSED');
  
   static public function getStatusChoices()
  {
    return self::$choices;
  }
  

  public function configure()
  {
  	
  	$years = range(2009, 2012); //Creates array of years between 2009-2012
$years_list = array_combine($years, $years); //Creates new array where key and value are both values from $years list
$koid = $this->object;
echo '<pre>'; print_r($koid); echo '</pre>';
  	$this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'stand_by'    => new sfWidgetFormInput(array('label' => ' Stand By')),
      'problem'     => new sfWidgetFormInput(array('label' => ' Problem')),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorPropelChoice(array('model' => 'Order', 'column' => 'id', 'required' => false)),
      'stand_by'    => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'problem'     => new sfValidatorString(array('max_length' => 50, 'required' => false)),
    ));
  }
  

  

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.