本文整理汇总了PHP中KInflector::tableize方法的典型用法代码示例。如果您正苦于以下问题:PHP KInflector::tableize方法的具体用法?PHP KInflector::tableize怎么用?PHP KInflector::tableize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KInflector
的用法示例。
在下文中一共展示了KInflector::tableize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTable
/**
* Get the identifier for the table with the same name
*
* @return KIdentifierInterface
*/
public function getTable()
{
if (!$this->_table) {
$identifier = clone $this->_identifier;
$identifier->name = KInflector::tableize($identifier->name);
$identifier->path = array('database', 'table');
$this->_table = KFactory::get($identifier);
}
return $this->_table;
}
示例2: __construct
/**
* Constructor
*
* @param array An optional associative array of configuration settings.
*/
public function __construct(array $options = array())
{
//set the model dbo
$this->_db = isset($options['dbo']) ? $options['dbo'] : KFactory::get('lib.joomla.database');
parent::__construct($options);
// set the table associated to the model
if (isset($options['table'])) {
$this->_table = $options['table'];
} else {
$table = KInflector::tableize($this->getClassName('suffix'));
$component = $this->getClassName('prefix');
$application = KFactory::get('lib.joomla.application')->getName();
$this->_table = $application . '::com.' . $component . '.table.' . $table;
}
}
示例3: setTable
/**
* Method to set a table object attached to the rowset
*
* @param mixed An object that implements KObjectServiceable, KServiceIdentifier object
* or valid identifier string
* @throws KDatabaseRowException If the identifier is not a table identifier
* @return KDatabaseRowsetAbstract
*/
public function setTable($table)
{
if (!$table instanceof KDatabaseTableAbstract) {
if (is_string($table) && strpos($table, '.') === false) {
$identifier = clone $this->getIdentifier();
$identifier->path = array('database', 'table');
$identifier->name = KInflector::tableize($table);
} else {
$identifier = $this->getIdentifier($table);
}
if ($identifier->path[1] != 'table') {
throw new KDatabaseRowsetException('Identifier: ' . $identifier . ' is not a table identifier');
}
$table = $identifier;
}
$this->_table = $table;
return $this;
}
示例4: setDocument
/**
* Method to set a document object attached to the model
*
* @param mixed An object that implements KObject, an object that
* implements KIdentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a document identifier
* @return KModelDocument
*/
public function setDocument($document)
{
if (!$document instanceof SDatabaseDocumentAbstract) {
if (is_string($document) && strpos($document, '.') === false) {
$identifier = clone $this->getIdentifier();
$identifier->path = array('database', 'document');
$identifier->name = KInflector::tableize($document);
} else {
$identifier = $this->getIdentifier($document);
}
if ($identifier->path[1] != 'document') {
throw new KDatabaseRowsetException('Identifier: ' . $identifier . ' is not a document identifier');
}
$document = $identifier;
}
$this->_document = $document;
return $this;
}
示例5: getTable
/**
* Get the identifier for the table with the same name
*
* Function catches KDatabaseTableExceptions that are thrown for tables that don't exist.
*
* @return KIdentifierInterface
*/
public function getTable()
{
if (!isset($this->_table)) {
try {
$identifier = clone $this->_identifier;
$identifier->name = KInflector::tableize($identifier->name);
$identifier->path = array('database', 'table');
$this->_table = KFactory::get($identifier);
} catch (KDatabaseTableException $e) {
//Set the table object to false
$this->_table = false;
}
}
return $this->_table;
}