Class CMS_object_search

Description

Class CMS_object_search

represent a search object

Located in /automne/classes/modules/polymod/object_search.php (line 27)

CMS_grandFather
   |
   --CMS_object_search
Class Constant Summary
Method Summary
 CMS_object_search __construct ($objectDefinition $objectDefinition, [boolean $public = false])
 void addOrderCondition ( $type, [string $direction = 'asc'], [ $operator = false], string $key)
 void addWhereCondition ( $type, string $value, [ $operator = false], string $key, string $operator,)
 string getAttribute (string $name)
 integer getMaxPages ()
 array(CMS_poly_object) getNextResult ([$return, $return = self::POLYMOD_SEARCH_RETURN_OBJECTS], [boolean $loadSubObjects = false])
 integer getNumRows ()
 array getScore ()
 boolean isLastResult ()
 mixed search ([$return, $return = self::POLYMOD_SEARCH_RETURN_OBJECTS], [boolean $loadSubObjects = false])
 void setAttribute (string $name, $value $value)
 string soapSearch ([string $searchConditions = ''])
 array _getIds ()
 array _getObjectValues ()
 string _getSQLTmpList ()
 array _sortIds ()
 boolean _updateTmpList ([array $ids = array()])
Methods
static getStaticOrderConditionTypes (line 422)

Get all static order conditions types

  • return: of condition types
  • access: public
static array getStaticOrderConditionTypes ()
static getStaticSearchConditionTypes (line 261)

Get all static where conditions types

  • return: of condition types
  • access: public
static array getStaticSearchConditionTypes ()
Constructor __construct (line 194)

Constructor

  • access: public
CMS_object_search __construct ($objectDefinition $objectDefinition, [boolean $public = false])
  • boolean $public
  • $objectDefinition $objectDefinition: CMS_poly_object_definition the current search object definition or the ID of the CMS_poly_object_definition
addOrderCondition (line 447)

Builds order statement with a key and its value The key can be a known string or it can be a field id, this method will create statements in consequence

  • return: or false if an error occured
  • access: public
void addOrderCondition ( $type, [string $direction = 'asc'], [ $operator = false], string $key)
  • string $key: name of statement to set
  • string $direction: , the direction to give (asc or desc, default is asc)
  • $type
  • $operator
addWhereCondition (line 299)

Builds where statement with a key and its value The key can be a known string, this class will create statements in consequence or it can be a field id

  • return: or false if an error occured
  • access: public
void addWhereCondition ( $type, string $value, [ $operator = false], string $key, string $operator,)
  • string $key: name of statement to set
  • string $value: , the value to give
  • string $operator,: additional optional search operator
  • $type
  • $operator
getAttribute (line 233)

Getter for any private attribute on this class

  • access: public
string getAttribute (string $name)
  • string $name
getMaxPages (line 511)

Count and returns how many of pages in resultset with current itemsPerpage value

  • access: public
integer getMaxPages ()
getNextResult (line 1629)

Returns the next result in the current search results stack, false if no results left Search must be already done using search method and mode self::POLYMOD_SEARCH_RETURN_INDIVIDUALS_OBJECTS.

  • access: public
array(CMS_poly_object) getNextResult ([$return, $return = self::POLYMOD_SEARCH_RETURN_OBJECTS], [boolean $loadSubObjects = false])
  • boolean $loadSubObjects: : all the founded objects can load theirs own sub objects (default false) /!\ CAUTION : Pass this option to true can generate a lot of subqueries /!\
  • $return, $return: the returned values in : self::POLYMOD_SEARCH_RETURN_OBJECTS for objetcs (default) self::POLYMOD_SEARCH_RETURN_OBJECTSLIGHT for light objects (without subobjects datas) self::POLYMOD_SEARCH_RETURN_OBJECTSLIGHT_EDITED for edited light objects. /!\ This method must not be used for objects which should be saved (used by getListOfNamesForObject only) /!\
getNumRows (line 496)

Count items founded with query COUNT(*)

  • access: public
integer getNumRows ()
getScore (line 284)

Get all results score for current search

  • return: of results score array(integer $resultId => float score)
  • access: public
array getScore ()
isLastResult (line 1681)

Does last result returned by method getNextResult is the last of the stack

  • access: public
boolean isLastResult ()
resetResultStack (line 1690)

Reset the results stack returned by the method getNextResult

  • access: public
void resetResultStack ()
search (line 1533)

Proceed to search and returns the array of results, null if none founded. All search options had been set yet.

  • return: array(CMS_poly_object) or boolean (for POLYMOD_SEARCH_RETURN_INDIVIDUALS_OBJECTS)
  • access: public
mixed search ([$return, $return = self::POLYMOD_SEARCH_RETURN_OBJECTS], [boolean $loadSubObjects = false])
  • boolean $loadSubObjects: : all the founded objects can load theirs own sub objects (default false) /!\ CAUTION : Pass this option to true can generate a lot of subqueries /!\
  • $return, $return: the returned values in : self::POLYMOD_SEARCH_RETURN_IDS for array of ids sorted self::POLYMOD_SEARCH_RETURN_DATAS for db datas self::POLYMOD_SEARCH_RETURN_OBJECTS for objetcs (default) self::POLYMOD_SEARCH_RETURN_OBJECTSLIGHT for light objects (without subobjects datas) self::POLYMOD_SEARCH_RETURN_OBJECTSLIGHT_EDITED for edited light objects. /!\ This method must not be used for objects which should be saved (used by getListOfNamesForObject only) /!\ self::POLYMOD_SEARCH_RETURN_INDIVIDUALS_OBJECTS use this method to get individual results with method getNextResult
setAttribute (line 245)

Setter for any private attribute on this class

  • access: public
void setAttribute (string $name, $value $value)
  • string $name: name of attribute to set
  • $value $value: , the value to give
soapSearch (line 1701)

Search items by xml definition. Return XML

  • return: XML definition of results IDs
  • access: public
string soapSearch ([string $searchConditions = ''])
  • string $searchConditions: XML definition to search with
_getIds (line 528)

Get all searched objects ids

  • return: of object ids unsorted
  • access: private
array _getIds ()
_getObjectValues (line 1471)

Get all searched objects (and subobjects) values

  • return: of values array(objectID => array(objectFieldID => array(objectSubfieldId => array(sql datas))))
  • access: private
array _getObjectValues ()
_getSQLTmpList (line 1231)

Get SQL tmp list of ids This method is used to avoid mysql crash because variable max_allowed_packet is too low

  • return: : the SQL
  • access: private
string _getSQLTmpList ()
_getSubObjectsIds (line 1245)

Get all subobjects values for searched objects results

  • return: of subobject ids sorted
  • access: private
array _getSubObjectsIds ()
_sortIds (line 1294)

Sort and limit founded ids by orders and limit clauses This method limit results to existant objects too

  • return: of object ids sorted
  • access: private
array _sortIds ()
_updateTmpList (line 1202)

Update temporary table with founded ids This method is used to avoid mysql crash because variable max_allowed_packet is too low

  • access: private
boolean _updateTmpList ([array $ids = array()])
  • array $ids: : the list of ids to update

Inherited Methods

Inherited From CMS_grandFather

 CMS_grandFather::autoload()
 CMS_grandFather::hasError()
 CMS_grandFather::log()
 CMS_grandFather::PHPErrorHandler()
 CMS_grandFather::raiseError()
 CMS_grandFather::setDebug()
 CMS_grandFather::setLog()
 CMS_grandFather::_raiseError()
 CMS_grandFather::__call()
Class Constants
POLYMOD_SEARCH_RETURN_DATAS = 2 (line 31)
POLYMOD_SEARCH_RETURN_IDS = 1 (line 30)
POLYMOD_SEARCH_RETURN_INDIVIDUALS_OBJECTS = 5 (line 34)
POLYMOD_SEARCH_RETURN_OBJECTS = 0 (line 29)
POLYMOD_SEARCH_RETURN_OBJECTSLIGHT = 3 (line 32)
POLYMOD_SEARCH_RETURN_OBJECTSLIGHT_EDITED = 4 (line 33)

Inherited Constants

Inherited from CMS_grandFather

CMS_grandFather::ERROR_LOG
CMS_grandFather::SYSTEM_LABEL

Documentation generated on Wed, 15 Feb 2012 15:34:48 +0100 by phpDocumentor 1.4.3