Beispiel #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['Match'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Match'][$this->hashCode()] = true;
     $keys = MatchTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getNr(), $keys[2] => $this->getDate(), $keys[3] => $this->getResult(), $keys[4] => $this->getToto(), $keys[5] => $this->getChampionshipId(), $keys[6] => $this->getRoundId(), $keys[7] => $this->getLeagueId(), $keys[8] => $this->getHometeamId(), $keys[9] => $this->getAwayteamId());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aChampionship) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'championship';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'championships';
                     break;
                 default:
                     $key = 'Championship';
             }
             $result[$key] = $this->aChampionship->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aRound) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'round';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'rounds';
                     break;
                 default:
                     $key = 'Round';
             }
             $result[$key] = $this->aRound->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aLeague) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'league';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'leagues';
                     break;
                 default:
                     $key = 'League';
             }
             $result[$key] = $this->aLeague->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aHometeam) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'team';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'teams';
                     break;
                 default:
                     $key = 'Team';
             }
             $result[$key] = $this->aHometeam->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aAwayteam) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'team';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'teams';
                     break;
                 default:
                     $key = 'Team';
             }
             $result[$key] = $this->aAwayteam->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collTips) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'tips';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'tipss';
                     break;
                 default:
                     $key = 'Tips';
             }
             $result[$key] = $this->collTips->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }