示例#1
0
 /**
  * Cut an attribute's value to it's maximum length in the database.
  *
  * @param string $attributeName
  */
 public function cutAttributeLength($attributeName)
 {
     if (!empty($this->columns[$attributeName]['length']) && \GO\Base\Util\String::length($this->_attributes[$attributeName]) > $this->columns[$attributeName]['length']) {
         $this->_attributes[$attributeName] = \GO\Base\Util\String::substr($this->_attributes[$attributeName], 0, $this->columns[$attributeName]['length']);
     }
 }
示例#2
0
文件: User.php 项目: ajaboa/crmpuan
 /**
  *
  * @return String Short name of the user 
  * Example: Foo Bar will output FB
  */
 public function getShortName()
 {
     if (!empty($this->first_name)) {
         $short = \GO\Base\Util\String::substr($this->first_name, 0, 1);
     }
     if (!empty($this->last_name)) {
         $short .= \GO\Base\Util\String::substr($this->last_name, 0, 1);
     }
     return strtoupper($short);
 }