Пример #1
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['SkillReference'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['SkillReference'][$this->hashCode()] = true;
     $keys = SkillReferenceTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getSkillId(), $keys[1] => $this->getReferenceId());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aSkill) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'skill';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'kk_trixionary_skill';
                     break;
                 default:
                     $key = 'Skill';
             }
             $result[$key] = $this->aSkill->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aReference) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'reference';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'kk_trixionary_reference';
                     break;
                 default:
                     $key = 'Reference';
             }
             $result[$key] = $this->aReference->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['Video'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Video'][$this->hashCode()] = true;
     $keys = VideoTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getTitle(), $keys[2] => $this->getDescription(), $keys[3] => $this->getUrl(), $keys[4] => $this->getIsTutorial(), $keys[5] => $this->getAthlete(), $keys[6] => $this->getAthleteId(), $keys[7] => $this->getUploaderId(), $keys[8] => $this->getSkillId(), $keys[9] => $this->getReferenceId(), $keys[10] => $this->getPosterUrl(), $keys[11] => $this->getProvider(), $keys[12] => $this->getProviderId(), $keys[13] => $this->getPlayerUrl(), $keys[14] => $this->getWidth(), $keys[15] => $this->getHeight());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aSkill) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'skill';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'kk_trixionary_skill';
                     break;
                 default:
                     $key = 'Skill';
             }
             $result[$key] = $this->aSkill->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aReference) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'reference';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'kk_trixionary_reference';
                     break;
                 default:
                     $key = 'Reference';
             }
             $result[$key] = $this->aReference->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collFeaturedSkills) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'skills';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'kk_trixionary_skills';
                     break;
                 default:
                     $key = 'Skills';
             }
             $result[$key] = $this->collFeaturedSkills->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collFeaturedTutorialSkills) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'skills';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'kk_trixionary_skills';
                     break;
                 default:
                     $key = 'Skills';
             }
             $result[$key] = $this->collFeaturedTutorialSkills->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }