Example #1
0
 public function testTableize()
 {
     $this->assertEquals("customer_tables", Inflector::tableize('customerTable'));
 }
 /**
  * @return string
  */
 public function createSecureItemName()
 {
     if (!($template = $this->secureItemTemplate)) {
         $uniquePart = strtoupper(Inflector::tableize((new \ReflectionClass($this->owner))->getShortName()));
         $template = 'ACCESS_' . $uniquePart;
     }
     $primaryKeys = $this->owner->getPrimaryKey(true);
     foreach ($primaryKeys as $value) {
         $template .= '_' . $value;
     }
     return $template;
 }
Example #3
0
 /**
  * Declares the name of the database table associated with this AR class.
  * By default this method returns the class name as the table name that is equal to plurlized form
  * of class name with camel case converted to lower case with words concatenated with underscopes.
  * For example, 'Customer' becomes '{{%customers}}', and 'OrderItem' becomes
  * '{{%order_items}}'. You may override this method if the table is not named after this convention.
  * @return string the table name
  */
 public static function tableName()
 {
     return '{{%' . Inflector::tableize(StringHelper::basename(get_called_class())) . '}}';
 }
 public function attach($owner)
 {
     parent::attach($owner);
     $folder = Inflector::tableize(StringHelper::basename($this->owner->className()));
     if (!$this->basePath) {
         $this->basePath = '@static/' . $folder;
     }
     if (!$this->baseUrl) {
         $this->baseUrl = '@staticUrl/' . $folder;
     }
 }