Example #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['Student'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Student'][$this->hashCode()] = true;
     $keys = StudentTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getIdentificationNumber(), $keys[2] => $this->getSchoolYearId(), $keys[3] => $this->getCourseId(), $keys[4] => $this->getFirstName(), $keys[5] => $this->getLastName(), $keys[6] => $this->getBirthPlace(), $keys[7] => $this->getBirthday(), $keys[8] => $this->getPhoneNumber(), $keys[9] => $this->getCreatedAt(), $keys[10] => $this->getUpdatedAt());
     $utc = new \DateTimeZone('utc');
     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->aCourse) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'course';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'course';
                     break;
                 default:
                     $key = 'Course';
             }
             $result[$key] = $this->aCourse->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->collAdminUsers) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'adminUsers';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'admin_users';
                     break;
                 default:
                     $key = 'AdminUsers';
             }
             $result[$key] = $this->collAdminUsers->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collApplications) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'applications';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'applications';
                     break;
                 default:
                     $key = 'Applications';
             }
             $result[$key] = $this->collApplications->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
Example #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['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;
 }
Example #3
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['Engagement'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Engagement'][$this->hashCode()] = true;
     $keys = EngagementTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getProfessorId(), $keys[1] => $this->getSubjectId(), $keys[2] => $this->getCourseId(), $keys[3] => $this->getSchoolYearId(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt());
     $utc = new \DateTimeZone('utc');
     if ($result[$keys[4]] instanceof \DateTime) {
         // When changing timezone we don't want to change existing instances
         $dateTime = clone $result[$keys[4]];
         $result[$keys[4]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z');
     }
     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');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aCourse) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'course';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'course';
                     break;
                 default:
                     $key = 'Course';
             }
             $result[$key] = $this->aCourse->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         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->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->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);
         }
     }
     return $result;
 }