Example #1
0
 /**
  * Get the methods that are available for mixin based
  *
  * This function conditionaly mixes the behavior. Only if the mixer
  * has a 'modified_by' or 'modified_by' property the behavior will
  * be mixed in.
  *
  * @param ObjectMixable $mixer The mixer requesting the mixable methods.
  * @return array An array of methods
  */
 public function getMixableMethods(ObjectMixable $mixer = null)
 {
     $methods = array();
     if ($mixer instanceof DatabaseRowInterface && ($mixer->has('modified_by') || $mixer->has('modified_on'))) {
         $methods = parent::getMixableMethods($mixer);
     }
     return $methods;
 }
Example #2
0
 /**
  * Get the methods that are available for mixin based
  *
  * This functions conditionaly mixes the behavior. Only if the mixer
  * has a 'ordering' property the behavior will be mixed in.
  *
  * @param ObjectMixable $mixer The mixer requesting the mixable methods.
  * @return array An array of methods
  */
 public function getMixableMethods(ObjectMixable $mixer = null)
 {
     $methods = array();
     if ($mixer instanceof DatabaseRowInterface && $mixer->has('ordering')) {
         $methods = parent::getMixableMethods($mixer);
     }
     return $methods;
 }
Example #3
0
 /**
  * Perform the actual mixin of all registered mixins for an object
  *
  * @param  ObjectIdentifier $identifier
  * @param  ObjectMixable    $mixer
  * @return ObjectMixable    The mixed object
  */
 protected function _mixin(ObjectIdentifier $identifier, $mixer)
 {
     if ($mixer instanceof ObjectMixable) {
         $mixins = $identifier->getMixins();
         foreach ($mixins as $mixin) {
             $mixer->mixin($mixin);
         }
     }
     return $mixer;
 }
Example #4
0
 /**
  * Perform the actual mixin of all registered mixins for an object
  *
  * @param  ObjectIdentifier $identifier
  * @param  ObjectMixable    $mixer
  * @return ObjectMixable    The mixed object
  */
 protected function _mixin(ObjectIdentifier $identifier, $mixer)
 {
     if ($mixer instanceof ObjectMixable) {
         $mixins = $identifier->getMixins();
         foreach ($mixins as $key => $value) {
             if (is_numeric($key)) {
                 $mixer->mixin($value);
             } else {
                 $mixer->mixin($key, $value);
             }
         }
     }
     return $mixer;
 }