예제 #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['Application'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Application'][$this->hashCode()] = true;
     $keys = ApplicationTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getStudentId(), $keys[2] => $this->getSubjectId(), $keys[3] => $this->getPeriodId(), $keys[4] => $this->getSchoolYearId(), $keys[5] => $this->getApplicationDate(), $keys[6] => $this->getExamDate(), $keys[7] => $this->getExamTime(), $keys[8] => $this->getExamScore(), $keys[9] => $this->getCreatedAt(), $keys[10] => $this->getUpdatedAt());
     $utc = new \DateTimeZone('utc');
     if ($result[$keys[5]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[5]];
         $result[$keys[5]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     if ($result[$keys[6]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[6]];
         $result[$keys[6]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     if ($result[$keys[7]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[7]];
         $result[$keys[7]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     if ($result[$keys[9]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[9]];
         $result[$keys[9]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     if ($result[$keys[10]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[10]];
         $result[$keys[10]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aPeriod) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'period';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'period';
                     break;
                 default:
                     $key = 'Period';
             }
             $result[$key] = $this->aPeriod->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aSubject) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'subject';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'subject';
                     break;
                 default:
                     $key = 'Subject';
             }
             $result[$key] = $this->aSubject->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aStudent) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'student';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'student';
                     break;
                 default:
                     $key = 'Student';
             }
             $result[$key] = $this->aStudent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aSchoolYear) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'schoolYear';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'school_year';
                     break;
                 default:
                     $key = 'SchoolYear';
             }
             $result[$key] = $this->aSchoolYear->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collApplicationRequests) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'applicationRequests';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'application_requests';
                     break;
                 default:
                     $key = 'ApplicationRequests';
             }
             $result[$key] = $this->collApplicationRequests->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     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['AdminUser'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['AdminUser'][$this->hashCode()] = true;
     $keys = AdminUserTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getLanguageId(), $keys[2] => $this->getProfessorId(), $keys[3] => $this->getStudentId(), $keys[4] => $this->getName(), $keys[5] => $this->getLogin(), $keys[6] => $this->getPassword(), $keys[7] => $this->getEmail(), $keys[8] => $this->getStatus(), $keys[9] => $this->getRememberToken(), $keys[10] => $this->getCreatedAt(), $keys[11] => $this->getUpdatedAt());
     $utc = new \DateTimeZone('utc');
     if ($result[$keys[10]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[10]];
         $result[$keys[10]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     if ($result[$keys[11]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[11]];
         $result[$keys[11]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aProfessor) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'professor';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'professor';
                     break;
                 default:
                     $key = 'Professor';
             }
             $result[$key] = $this->aProfessor->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aStudent) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'student';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'student';
                     break;
                 default:
                     $key = 'Student';
             }
             $result[$key] = $this->aStudent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aTranslationLanguage) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'translationLanguage';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'translation_language';
                     break;
                 default:
                     $key = 'TranslationLanguage';
             }
             $result[$key] = $this->aTranslationLanguage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collAdminUserCredentials) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'adminUserCredentials';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'admin_user_credentials';
                     break;
                 default:
                     $key = 'AdminUserCredentials';
             }
             $result[$key] = $this->collAdminUserCredentials->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }