public function onInsert()
 {
     if (self::isUndef($this->getMark())) {
         $this->mark = null;
     }
     parent::onInsert();
 }
示例#2
0
文件: User.php 项目: maxisoft/m2test6
 private static function allSqlPropertiesNotUndef($instance)
 {
     $properties = get_class_vars(get_class($instance));
     foreach ($properties as $name => $value) {
         if (BaseObject::isSqlPropertyMapping($name)) {
             if ($instance->isUndef($value)) {
                 return false;
             }
         }
     }
     return true;
 }
示例#3
0
 public function testIsSqlPropertyMapping()
 {
     $this->given($res = \website\db\BaseObject::isSqlPropertyMapping('toto'))->then->boolean($res)->isTrue();
     $this->given($res = \website\db\BaseObject::isSqlPropertyMapping('_toto'))->then->boolean($res)->isFalse();
     $this->given($res = \website\db\BaseObject::isSqlPropertyMapping('Toto'))->then->boolean($res)->isFalse();
     //snake case support
     $this->given($res = \website\db\BaseObject::isSqlPropertyMapping('toto_et_tata'))->then->boolean($res)->isTrue();
     //camel case support
     $this->given($res = \website\db\BaseObject::isSqlPropertyMapping('totoEtTata'))->then->boolean($res)->isTrue();
 }