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
https://forums.phpfreaks.com/topic/254461-help-with-object/
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
https://forums.phpfreaks.com/topic/254461-help-with-object/#findComment-1304745
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.