function makeCollectionNameForTable($table)
 {
     if (is_object($table)) {
         $table = $table->getName();
     }
     return lmb_plural($table);
 }
Пример #2
0
 function testPlural()
 {
     //$this->assertEqual(lmb_plural('dog'), 'dogs');
     $this->assertEqual(lmb_plural('glass'), 'glasses');
     $this->assertEqual(lmb_plural('dictionary'), 'dictionaries');
     $this->assertEqual(lmb_plural('boy'), 'boys');
     $this->assertEqual(lmb_plural('half'), 'halves');
     $this->assertEqual(lmb_plural('man'), 'men');
 }
 function _formRelationManyToMany($local_table, $relation_table)
 {
     $local_relation_column_name = $this->_aggrements_resolver->makeRelationColumnNameFromTable($local_table->getName());
     $related_tables = $this->_aggrements_resolver->getManyToManyRelatedTablesFromRelationTable($relation_table);
     $foreign_table = $related_tables[0] == $local_table->getName() ? $this->_db_info->getTable($related_tables[1]) : $this->_db_info->getTable($related_tables[0]);
     return array(lmb_plural($foreign_table->getName()) => array('field' => $local_relation_column_name, 'foreign_field' => $this->_aggrements_resolver->makeRelationColumnNameFromTable($foreign_table), 'table' => $relation_table->getName(), 'class' => lmb_camel_case($foreign_table->getName())));
 }