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); } }
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(); } }
function testPlural() { $this->assertEqual('products', SInflection::pluralize('product')); }