コード例 #1
0
ファイル: RatingValue.php プロジェクト: pcmasteratings/site
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
  *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
  *                    Defaults to TableMap::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['RatingValue'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['RatingValue'][$this->hashCode()] = true;
     $keys = RatingValueTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getRatingHeaderId(), $keys[1] => $this->getCategoryOptionId(), $keys[2] => $this->getOriginalValue(), $keys[3] => $this->getDoNotScore(), $keys[4] => $this->getComments());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aCategoryOption) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'categoryOption';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'category_option';
                     break;
                 default:
                     $key = 'CategoryOption';
             }
             $result[$key] = $this->aCategoryOption->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aRatingHeader) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'ratingHeader';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'rating_header';
                     break;
                 default:
                     $key = 'RatingHeader';
             }
             $result[$key] = $this->aRatingHeader->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
コード例 #2
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
  *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
  *                    Defaults to TableMap::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['CategoryOption'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['CategoryOption'][$this->hashCode()] = true;
     $keys = CategoryOptionTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getCategoryId(), $keys[2] => $this->getDescription(), $keys[3] => $this->getComment(), $keys[4] => $this->getModComment(), $keys[5] => $this->getValue(), $keys[6] => $this->getSequence(), $keys[7] => $this->getParentId());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aCategory) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'category';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'category';
                     break;
                 default:
                     $key = 'Category';
             }
             $result[$key] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aCategoryOptionRelatedByParentId) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'categoryOption';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'category_option';
                     break;
                 default:
                     $key = 'CategoryOption';
             }
             $result[$key] = $this->aCategoryOptionRelatedByParentId->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collCategoryOptionsRelatedById) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'categoryOptions';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'category_options';
                     break;
                 default:
                     $key = 'CategoryOptions';
             }
             $result[$key] = $this->collCategoryOptionsRelatedById->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collRatingValues) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'ratingValues';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'rating_values';
                     break;
                 default:
                     $key = 'RatingValues';
             }
             $result[$key] = $this->collRatingValues->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }