Exemplo n.º 1
0
 /**
  * Constructor for this ApiFieldMap.
  * 
  * @param string $request_field
  * @param integer $flags                  //a combination of flags of this field
  * @param string $description
  * @param string $model_accessor          
  *   //eg. provide: "CountryByCountryCode" and it will become 
  *     "getCountryByCountryCode" and "setCountryByCountryCode"
  *                                           
  * @return \sfAltumoPlugin\Api\ApiFieldMap
  */
 public function __construct($request_field, $flags = null, $description = null, $model_accessor = null)
 {
     if (!is_string($request_field)) {
         throw new \Exception('Request field must be a string.');
     }
     $this->setRequestField($request_field);
     if (!is_null($flags)) {
         $this->setFlags($flags);
     }
     if (!is_null($description)) {
         $this->setDescription($description);
     } else {
         $description = \Altumo\String\String::formatTitleCase(str_replace('_', ' ', $request_field));
         $this->setDescription($description);
     }
     if (!is_null($model_accessor)) {
         $this->setModelAccessor($model_accessor);
     } else {
         $accessor_suffix = \Altumo\String\String::formatCamelCase($request_field);
         $this->setModelAccessor($accessor_suffix);
     }
 }