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['Article'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Article'][$this->hashCode()] = true;
     $keys = ArticleTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getIdUser(), $keys[2] => $this->getIdImage(), $keys[3] => $this->getIdCategory(), $keys[4] => $this->getTitle(), $keys[5] => $this->getUrl(), $keys[6] => $this->getKeywords(), $keys[7] => $this->getContent(), $keys[8] => $this->getCreatedAt(), $keys[9] => $this->getUpdatedAt());
     if ($result[$keys[8]] instanceof \DateTime) {
         $result[$keys[8]] = $result[$keys[8]]->format('c');
     }
     if ($result[$keys[9]] instanceof \DateTime) {
         $result[$keys[9]] = $result[$keys[9]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'user';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'users';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aImage) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'image';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'images';
                     break;
                 default:
                     $key = 'Image';
             }
             $result[$key] = $this->aImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aCategory) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'category';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'categories';
                     break;
                 default:
                     $key = 'Category';
             }
             $result[$key] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collComments) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'comments';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'commentss';
                     break;
                 default:
                     $key = 'Comments';
             }
             $result[$key] = $this->collComments->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['Note'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Note'][$this->hashCode()] = true;
     $keys = NoteTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getImportance(), $keys[3] => $this->getTitle(), $keys[4] => $this->getDeadline(), $keys[5] => $this->getCategoryId(), $keys[6] => $this->getState(), $keys[7] => $this->getRepeatAfter(), $keys[8] => $this->getDoneAt(), $keys[9] => $this->getPublic(), $keys[10] => $this->getDescription(), $keys[11] => $this->getCreatedAt(), $keys[12] => $this->getUpdatedAt());
     if ($result[$keys[4]] instanceof \DateTime) {
         $result[$keys[4]] = $result[$keys[4]]->format('c');
     }
     if ($result[$keys[8]] instanceof \DateTime) {
         $result[$keys[8]] = $result[$keys[8]]->format('c');
     }
     if ($result[$keys[11]] instanceof \DateTime) {
         $result[$keys[11]] = $result[$keys[11]]->format('c');
     }
     if ($result[$keys[12]] instanceof \DateTime) {
         $result[$keys[12]] = $result[$keys[12]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'user';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'user';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         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->collSubNotes) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'subNotes';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'sub_notes';
                     break;
                 default:
                     $key = 'SubNotes';
             }
             $result[$key] = $this->collSubNotes->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collFiles) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'files';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'files';
                     break;
                 default:
                     $key = 'Files';
             }
             $result[$key] = $this->collFiles->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collNotifications) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'notifications';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'notifications';
                     break;
                 default:
                     $key = 'Notifications';
             }
             $result[$key] = $this->collNotifications->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collComments) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'comments';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'comments';
                     break;
                 default:
                     $key = 'Comments';
             }
             $result[$key] = $this->collComments->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collShareds) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'shareds';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'shareds';
                     break;
                 default:
                     $key = 'Shareds';
             }
             $result[$key] = $this->collShareds->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['Shared'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Shared'][$this->hashCode()] = true;
     $keys = SharedTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getWhatId(), $keys[2] => $this->getWhatType(), $keys[3] => $this->getToId(), $keys[4] => $this->getToType(), $keys[5] => $this->getRights(), $keys[6] => $this->getCreatedAt(), $keys[7] => $this->getUpdatedAt());
     if ($result[$keys[6]] instanceof \DateTime) {
         $result[$keys[6]] = $result[$keys[6]]->format('c');
     }
     if ($result[$keys[7]] instanceof \DateTime) {
         $result[$keys[7]] = $result[$keys[7]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aNote) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'note';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'note';
                     break;
                 default:
                     $key = 'Note';
             }
             $result[$key] = $this->aNote->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         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->aUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'user';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'user';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aGroup) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'group';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'group';
                     break;
                 default:
                     $key = 'Group';
             }
             $result[$key] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }