Пример #1
0
 function __construct($searchFields)
 {
     if (is_array($searchFields)) {
         $this->searchFields = implode(',', $searchFields);
     } else {
         $this->searchFields = $searchFields;
     }
     parent::__construct();
 }
Пример #2
0
 /**
  * Construct a new Versioned object.
  * @var array $stages The different stages the versioned object can be.
  * The first stage is consiedered the 'default' stage, the last stage is
  * considered the 'live' stage.
  */
 function __construct($stages)
 {
     parent::__construct();
     if (!is_array($stages)) {
         $stages = func_get_args();
     }
     $this->stages = $stages;
     $this->defaultStage = reset($stages);
     $this->liveStage = array_pop($stages);
 }
 /**
  * Called by the system when initialising each instance of the decorated 
  * class.  The argument comes from the Object::add_extension call in the 
  * project's _config.php file.
  *
  * Field configuration can simply be a comma-separated list of fieldnames to scan,
  * or alternatively can be a json-encoded string containing extended config 
  * information.  Or you can leave it blank.
  * 
  * All keys are optional for each fieldname.  The format for $fieldConfig is:
  *
  * <code>
  * array(
  *    'FieldName' => array(
  *        'name' => 'StoredName',
  *        'type' => 'keyword|unindexed|unstored|text',
  *        'content_filter' => [callback]|false
  *     ),
  *     [...]
  * )
  * </code>
  * 
  * FieldName - the name of the field on the decorated class
  *
  * name - the name to store this as in the document.  Default is the same as
  * the FieldName.  The FieldName of 'ID' is a special case, this will always 
  * use a name of 'ObjectID' as this is used internally.
  * 
  * type - the type of indexing to use.  Default is 'text'.
  * 
  * content_filter - a callback that should be used to transform the field value
  * prior to being indexed.  The callback will be called with one argument, 
  * the field value as a string, and should return the transformed field value
  * also as a string.  Could be useful for eg. turning date strings into unix 
  * timestamps prior to indexing.  A value of false will indicate that there
  * should be no content filtering, which is the default.
  * 
  * Class-level configuration should be a json-encoded string containing 
  * key-value pairs for the class-level config options.  The format for 
  * $classConfig is:
  *
  * <code>
  * array(
  *     'index_filter' => 'WHERE clause'
  * )
  * </code>
  * 
  * index_filter - a string to be used as the second argument to 
  * DataObject::get().  An example of how this might be used in a complex 
  * situation:
  *
  * '"ID" IN ( SELECT "ID" FROM "This" LEFT JOIN "Other" ON "This"."ID" = "Other"."ThisID" WHERE "Other"."ThisID" IS NOT NULL )'
  */
 public function __construct($fieldConfig = null, $classConfig = null)
 {
     parent::__construct();
     $this->_fieldConfig = $fieldConfig;
     $this->_classConfig = $classConfig;
 }
Пример #4
0
 /**
  * Construct a new Translatable object.
  * @var array $translatableFields The different fields of the object that can be translated.
  */
 function __construct($translatableFields)
 {
     parent::__construct();
     if (!is_array($translatableFields)) {
         $translatableFields = func_get_args();
     }
     $this->translatableFields = $translatableFields;
 }
Пример #5
0
 /**
  * Construct a new Translatable object.
  * @var array $translatableFields The different fields of the object that can be translated.
  * This is currently not implemented, all fields are marked translatable (see {@link setOwner()}).
  */
 function __construct($translatableFields = null)
 {
     parent::__construct();
     // @todo Disabled selection of translatable fields - we're setting all fields as translatable in setOwner()
     /*
     if(!is_array($translatableFields)) {
     	$translatableFields = func_get_args();
     }
     $this->translatableFields = $translatableFields;
     */
     // workaround for extending a method on another decorator (Hierarchy):
     // split the method into two calls, and overwrite the wrapper AllChildrenIncludingDeleted()
     // Has to be executed even with Translatable disabled, as it overwrites the method with same name
     // on Hierarchy class, and routes through to Hierarchy->doAllChildrenIncludingDeleted() instead.
     // Caution: There's an additional method for augmentAllChildrenIncludingDeleted()
 }
 function __construct($moderationScore = null, $spamScore = null)
 {
     parent::__construct();
     $this->RequiredModerationScore = $moderationScore ? $moderationScore : $this->stat('default_moderation_score');
     $this->RequiredSpamScore = $spamScore ? $spamScore : $this->stat('default_spam_score');
 }