コード例 #1
0
 protected function initialize()
 {
     if ($this->scaffold !== null) {
         $this->models[] = $this->scaffold;
         if (strpos($this->scaffold, '/') !== false) {
             list(, $this->scaffold) = explode('/', $this->scaffold);
         }
         $this->class_name = SInflection::camelize($this->scaffold);
         $this->singular_name = strtolower($this->scaffold);
         $this->plural_name = SInflection::pluralize($this->singular_name);
     }
 }
コード例 #2
0
 public function __construct($values = Null, $dontInitAssocs = false, $newRecord = True)
 {
     if ($this->tableName == Null) {
         $this->tableName = SInflection::pluralize(strtolower(get_class($this)));
     }
     if (empty($this->attributes)) {
         $this->attributes = SActiveStore::getAttributes($this->tableName);
     } else {
         $this->initAttributes();
     }
     $this->initValues();
     if ($values != Null && is_array($values)) {
         $this->populate($values);
     }
     $this->newRecord = $newRecord;
     if (!$dontInitAssocs) {
         $this->initAssociations();
     }
 }
コード例 #3
0
 function testPlural()
 {
     $this->assertEqual('products', SInflection::pluralize('product'));
 }