public function GetOneToMany($parent, $keyname, $criteria)
    {

		// get the keymap for this child relationship
		$km = $this->GetKeyMap(get_class($parent), $keyname);

		// we need the value of the foreign key.  (ex. to get all orders for a customer, we need Customer.Id)
		$parent_prop = $km->KeyProperty;
		$key_value = $parent->$parent_prop;

		if (!$criteria)
		{
			// if no criteria was specified, then create a generic one.  we can specify SQL
			// code in the constructor, but we have to translate the properties into column names
			$foreign_table = $this->GetTableName($km->ForeignObject,$km->ForeignKeyProperty);
			$foreign_column = $this->GetColumnName($km->ForeignObject,$km->ForeignKeyProperty);
			$criteria = new Criteria("`" . $foreign_table . "`.`" . $foreign_column . "` = '" . $this->Escape($key_value) . "'");
		}
		else
		{
			// ensure that the criteria passed in will filter correctly by foreign key
			$foreign_prop = $km->ForeignKeyProperty;

			// this is only for backwards compatibility with phreeze 2.0 apps
			if (self::$COMPAT_VERSION_2) $criteria->$foreign_prop = $key_value;

			// the current criteria "Equals" format "FieldName_Equals"
			$foreign_prop .= "_Equals";
			$criteria->$foreign_prop = $key_value;

			// if this criteria has any or criterias attached, we need to set the foreign key to these
			// as well or else we'll get unexpected results
			foreach ($criteria->GetOrs() as $oc)
			{
				$oc->$foreign_prop = $key_value;
			}
		}

		return $this->Query($km->ForeignObject,$criteria);
	}
public function GetOneToMany($parent, $keyname, $criteria)
    {

		// get the keymap for this child relationship
		$km = $this->GetKeyMap(get_class($parent), $keyname);

		// we need the value of the foreign key.  (ex. to get all orders for a customer, we need Customer.Id)
		$parent_prop = $km->KeyProperty;
		$key_value = $parent->$parent_prop;

		if (!$criteria)
		{
			// if no criteria was specified, then create a generic one.  we can specify SQL
			// code in the constructor, but we have to translate the properties into column names
			$foreign_table = $this->GetTableName($km->ForeignObject,$km->ForeignKeyProperty);
			$foreign_column = $this->GetColumnName($km->ForeignObject,$km->ForeignKeyProperty);
			$criteria = new Criteria("`" . $foreign_table . "`.`" . $foreign_column . "` = '" . $this->Escape($key_value) . "'");
		}
		else
		{
			// ensure that the criteria passed in will filter correctly by foreign key
			$foreign_prop = $km->ForeignKeyProperty;

			// this is only for backwards compatibility with phreeze 2.0 apps
			if (self::$COMPAT_VERSION_2) $criteria->$foreign_prop = $key_value;

			// the current criteria "Equals" format "FieldName_Equals"
			$foreign_prop .= "_Equals";
			$criteria->$foreign_prop = $key_value;

			// if this criteria has any or criterias attached, we need to set the foreign key to these
			// as well or else we'll get unexpected results
			foreach ($criteria->GetOrs() as $oc)
			{
				$oc->$foreign_prop = $key_value;
			}
		}

		return $this->Query($km->ForeignObject,$criteria);
	}
public function GetOneToMany ( $ parent , $ keyname , $ criteria ) { // get the keymap for this child relationship
 $ km = $ this -> GetKeyMap ( get_class ( $ parent ) , $ keyname ) ; // we need the value of the foreign key.  (ex. to get all orders for a customer, we need Customer.Id)
 $ parent_prop = $ km -> KeyProperty ; $ key_value = $ parent -> $ parent_prop ; if ( ! $ criteria ) { // if no criteria was specified, then create a generic one.  we can specify SQL
 // code in the constructor, but we have to translate the properties into column names
 $ foreign_table = $ this -> GetTableName ( $ km -> ForeignObject , $ km -> ForeignKeyProperty ) ; $ foreign_column = $ this -> GetColumnName ( $ km -> ForeignObject , $ km -> ForeignKeyProperty ) ; $ criteria = new Criteria ( "`" . $ foreign_table . "`.`" . $ foreign_column . "` = '" . $ this -> Escape ( $ key_value ) . "'" ) ; } else { // ensure that the criteria passed in will filter correctly by foreign key
 $ foreign_prop = $ km -> ForeignKeyProperty ; // this is only for backwards compatibility with phreeze 2.0 apps
 if ( self :: $ COMPAT_VERSION_2 ) $ criteria -> $ foreign_prop = $ key_value ; // the current criteria "Equals" format "FieldName_Equals"
 $ foreign_prop .= "_Equals" ; $ criteria -> $ foreign_prop = $ key_value ; // if this criteria has any or criterias attached, we need to set the foreign key to these
 // as well or else we'll get unexpected results
 foreach ( $ criteria -> GetOrs ( ) as $ oc ) { $ oc -> $ foreign_prop = $ key_value ; } } return $ this -> Query ( $ km -> ForeignObject , $ criteria ) ; }
Query for a child objects in a one-to-many relationship

@access public
@param Phreezable $parent the parent object
@param string $keyname The name of the key representing the relationship
@return Criteria $criteria a Criteria object to limit the results
Query for a child objects in a one - to - many relationship