api.zedseries.com
[ class tree: Model ] [ index: Model ] [ all elements ]

Class: ZedSeriesModelUtils

Source Location: /ZedSeriesModelUtils.php

Class ZedSeriesModelUtils

Class Overview

Class ZedSeriesModelUtils

Located in /ZedSeriesModelUtils.php [line 24]



		
				Author(s):
		
		
		
Information Tags:
Copyright:  Angelo Galleja 2008,2009,2010

Methods

[ Top ]
Method Summary
static array   getAssocEq()   return an associative array from the specified table
static mixed   getFieldValue()   get the value of a field
static mixed   getModelByField()   create a ZedSeriesModel by the given table, and search for selected field (usually id)

[ Top ]
Methods
static method getAssocEq  [line 90]

  static array getAssocEq( string $strTable, string $keyField, string $valueField, [array $arrWhere = array()]  )

return an associative array from the specified table

Parameters:
string   $strTable:  the table to query
string   $keyField:  the field to be used as a key of the returned array
string   $valueField:  the field to be used as a value of the return array
array   $arrWhere:  an associative array with field => condition used to querying the $strTable

API Tags:
Access:  public


[ Top ]
static method getFieldValue  [line 38]

  static mixed getFieldValue( string $strTable, int $intId, string $fieldName  )

get the value of a field

the return value should be compared with the === operator

Parameters:
string   $strTable:  table to query
int   $intId:  id
string   $fieldName:  field name

API Tags:
Return:  false if the record could not be found, or the $fieldName value
Access:  public


[ Top ]
static method getModelByField  [line 63]

  static mixed getModelByField( $strTable $strTable, $varValue $varValue, [$strField $strField = 'id']  )

create a ZedSeriesModel by the given table, and search for selected field (usually id)

  1. <?php
  2.  
  3. /**
  4.  * a quick way to update the published field of a tl_page
  5.  *
  6.  * in the following example we retrieve the page ID 1 and set its published field to 1
  7.  *
  8.  */
  9.  
  10. $mod ZedSeriesModelUtils::getModelByField('tl_page'1'id');
  11.  
  12. if ($mod !== false{
  13.     $mod->published 1;
  14.     $mod->save();
  15. else {
  16.     echo 'page id 1 not found';
  17. }

Parameters:
$strTable   $strTable:  tablename
$varValue   $varValue:  value to search for
$strField   $strField:  field to query

API Tags:
Return:  object if the record was found else return false
Access:  public


[ Top ]

Documentation generated on Fri, 22 Oct 2010 17:37:23 +0200 by phpDocumentor 1.4.1