本文整理汇总了PHP中sfInflector::tableize方法的典型用法代码示例。如果您正苦于以下问题:PHP sfInflector::tableize方法的具体用法?PHP sfInflector::tableize怎么用?PHP sfInflector::tableize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfInflector
的用法示例。
在下文中一共展示了sfInflector::tableize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extendEvent
/**
* Can be used inside a magic __call method to allow for a class to be extended
*
* This method will throw a class_name.method_not_found event,
* where class_name is the "tableized" class name.
*
* @example
* public function __call($method, $arguments)
* {
* return sfSympalExtendClass::extendEvent($this, $method, $arguments);
* }
*
* @param mixed $subject Instance of the class being extended
* @param string $method The current method being called
* @param array $arguments The arguments being passed to the above methid
*/
public static function extendEvent($subject, $method, $arguments)
{
$name = sfInflector::tableize(get_class($subject));
$event = ProjectConfiguration::getActive()->getEventDispatcher()->notifyUntil(new sfEvent($subject, $name . '.method_not_found', array('method' => $method, 'arguments' => $arguments)));
if (!$event->isProcessed()) {
throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($subject), $method));
}
return $event->getReturnValue();
}
示例2: linkToObject
public function linkToObject($class, $html, $params)
{
$showRoute = sfInflector::tableize($class) . '_show';
$routes = sfContext::getInstance()->getRouting()->getRoutes();
if (isset($routes[$showRoute]) && $routes[$showRoute] instanceof sfDoctrineRoute) {
$options = $routes[$showRoute]->getOptions();
if ($options['model'] == $class) {
$html = sprintf("link_to(%s, '%s', %s)", $html, $showRoute, $html);
}
}
return $html;
}
示例3: installPlugin
function installPlugin($name, $t)
{
// Install the plugin
$manager = sfSympalPluginManager::getActionInstance($name, 'install');
$manager->install();
// Check that content type was created
$contentTypeName = $manager->getContentTypeForPlugin($name);
$contentType = Doctrine_Core::getTable('sfSympalContentType')->findOneByName($contentTypeName);
$t->is($contentType['name'], $contentTypeName, 'Test content type name set');
$t->is($contentType['label'], sfInflector::humanize(sfInflector::tableize(str_replace('sfSympal', null, $contentTypeName))), 'Test content type label set');
$t->is($contentType['plugin_name'], $name, 'Test content type plugin name set');
$contentList = Doctrine_Core::getTable('sfSympalContentList')->findOneByContentTypeId($contentType['id']);
$t->is($contentList instanceof sfSympalContentList, true, 'Test sample content list was created.');
$menuItem = Doctrine_Core::getTable('sfSympalMenuItem')->findOneByContentId($contentList['content_id']);
$t->is($menuItem instanceof sfSympalMenuItem, true, 'Test menu item to sample content list was created.');
}
示例4: joinForTableProxy
public function joinForTableProxy(Doctrine_Query $q, array $options = array())
{
$options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
$q->getRootAlias();
// fix for initialize root
if (empty($options['parentTable'])) {
$parentTable = $q->getRoot();
$parentTableAlias = $q->getRootAlias();
} else {
$parentTable = Doctrine::getTable($options['parentTable']);
$parentTableAlias = empty($options['parentTableAlias']) ? $q->getSqlTableAlias(sfInflector::tableize($options['parentTable'])) : $options['parentTableAlias'];
}
if (!empty($options['componentAlias'])) {
$componentAlias = $options['componentAlias'];
} elseif ($parentTable->hasRelation($this->_table->getComponentName())) {
$componentAlias = $this->_table->getComponentName();
} else {
$componentName = $this->_table->getComponentName();
$relations = $parentTable->getRelations();
foreach ($relations as $relation) {
if ($relation['class'] == $componentName) {
$componentAlias = $relation['alias'];
break;
}
}
}
$tableAlias = empty($options['tableAlias']) ? $this->_table->getAlias() : $options['tableAlias'];
$q->addSqlTableAlias($tableAlias, sfInflector::tableize($this->_table->getComponentName()));
$q->leftJoin($parentTableAlias . '.' . $componentAlias . ' ' . $tableAlias);
if ($options['withI18n'] == true && $this->_table->hasTemplate('Doctrine_Template_I18nMod')) {
$cultures = empty($options['cultures']) ? sfContext::getInstance()->getUser()->getCulture() : $options['cultures'];
$chunkWith = implode(' AND ', array_fill(0, count($cultures), ' ' . $tableAlias . '_trans.lang = ? '));
$q->leftJoin($tableAlias . '.Translation ' . $tableAlias . '_trans WITH ' . $chunkWith, $cultures);
}
return $q;
}
示例5: executeEmail
/**
* Execute share by email method
*
* @param sfWebRequest $request
*/
public function executeEmail(sfWebRequest $request)
{
$user = $this->getUser();
$search_public_models = sfConfig::get('app_rt_search_public_models', array('rtShopProduct', 'rtShopCategory', 'rtBlogPage', 'rtSitePage', 'rtWikiPage'));
$this->model = $request->getParameter('model');
$this->model_id = $request->getParameter('model_id');
$this->route_name = sfInflector::tableize($this->model) . '_show';
$this->object = Doctrine_Core::getTable($this->model)->find(array($this->model_id));
// Exception handling
if (!in_array($this->model, $search_public_models) || !$this->object) {
throw new sfException(sprintf('Object %s does not exist.', $this->model));
}
// Form
$this->form = new rtSocialEmailPublicForm();
if ($this->getRequest()->isMethod('PUT') || $this->getRequest()->isMethod('POST')) {
$this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
if ($this->form->isValid()) {
$form_values = $this->form->getValues();
$this->notifyAudience($this->object, $form_values, $this->route_name);
} else {
$this->getUser()->setFlash('default_error', true, false);
}
}
}
示例6: get_partial
echo get_partial('sympal_default/render_form', array('form' => $embeddedForms[$name]));
?>
</div>
<?php
} else {
?>
<div class="sf_admin_form_row<?php
$widget->hasError() and print ' errors';
$validatorSchema[$name]->getOption('required') and print ' required';
?>
">
<?php
if ($help = $widget->renderHelp()) {
?>
<?php
$helpId = sfInflector::tableize($name) . '_help';
?>
<span id="<?php
echo $helpId;
?>
" class="help" style="float: right;" title="<?php
echo strip_tags($help);
?>
">
<?php
echo image_tag('/sf/sf_admin/images/help.png');
?>
</span>
<?php
}
?>
示例7: image_tag
<tr>
<td class="values">
<?php
echo $form->renderHiddenFields();
?>
<?php
echo sfInflector::humanize(sfInflector::tableize($form['keyword_type']->getValue()));
?>
</td>
<td>
<?php
echo $form['keyword_type']->renderError();
?>
<?php
echo $form['keyword'];
?>
</td>
<td class="widget_row_delete">
<?php
echo image_tag('remove.png', 'alt=Delete class=clear_prop id=' . $form['keyword_type']->getValue());
?>
</td>
</tr>
示例8: use_helper
<?php
/*
* Important set of helper variables for usage in the layout template.
*
*
*/
use_helper('rtTemplate');
$routes = $sf_context->getRouting()->getRoutes();
$module = $sf_request->getParameter('module');
$action = $sf_request->getParameter('action');
$area_class = Doctrine_Inflector::urlize(sfInflector::tableize($module));
$area_class .= ' ' . $area_class . '-' . Doctrine_Inflector::urlize(sfInflector::tableize($action));
$snippet_area = Doctrine_Inflector::urlize(sfInflector::tableize($module) . '-' . sfInflector::tableize($action));
示例9: tableize
/**
* Camel case to underscored.
*
* @param $string
* @return string
*/
private function tableize($string)
{
return sfInflector::tableize($string);
}
示例10: init
public function init()
{
$this->_eventName = sfInflector::tableize($this->_table->getOption('name'));
}
示例11: setInvoker
/**
* Override the setInvoker() method to allow us to generate the event name
*
* @param Doctrine_Record_Abstract $invoker
* @return void
*/
public function setInvoker(Doctrine_Record_Abstract $invoker)
{
parent::setInvoker($invoker);
$this->_eventName = sfInflector::tableize(get_class($invoker));
}
示例12: include_stylesheets_for_form
<?php
include_stylesheets_for_form($form);
include_javascripts_for_form($form);
?>
<span id="sympal_content_slot_<?php
echo $contentSlot->getId();
?>
_editor_form" class="sympal_<?php
echo sfInflector::tableize($contentSlot->getType());
?>
_content_slot_editor_form">
<?php
echo $form->renderHiddenFields();
?>
<?php
echo sfSympalToolkit::getSymfonyResource($contentSlot->getSlotEditFormRenderer(), array('contentSlot' => $contentSlot, 'form' => $form));
?>
</span>
<script type="text/javascript">
<?php
if ($contentSlot->getType() == 'Markdown' && sfSympalConfig::get('enable_markdown_editor', null, true)) {
?>
$(function() {
$('#sympal_content_slot_<?php
echo $contentSlot->getId();
?>
_editor_form textarea').markItUp(mySettings);
示例13: renameModel
/**
* Rename model functionality
*
* @param string $name
* @return afResponse
* @author Sergey Startsev
*/
public function renameModel($name)
{
$response = afResponseHelper::create();
$are_writable = $this->isModelWritable();
if ($are_writable !== true) {
return $are_writable;
}
if (!afStudioModelCommandHelper::isValidName($name)) {
return $response->success(false)->message('Model name can only consist from alphabetical characters and begins from letter or "_"');
}
$this->originalSchemaArray[$this->getSchemaFile()]['propel'][$this->getTableName()]['_attributes']['phpName'] = $name;
$newTableName = sfInflector::tableize($name);
$this->originalSchemaArray[$this->getSchemaFile()]['propel'][$newTableName] = $this->originalSchemaArray[$this->getSchemaFile()]['propel'][$this->getTableName()];
unset($this->originalSchemaArray[$this->getSchemaFile()]['propel'][$this->getTableName()]);
if ($this->saveSchema()) {
afStudioConsole::getInstance()->execute('sf afs:fix-perms');
list($status, $message) = afStudioModelCommandHelper::renameModel($this->getModelName(), $name);
afStudioModelCommandHelper::removeModelFiles($this->getModelName());
return $response->success(true)->message("Renamed model's phpName from <b>{$this->getModelName()}</b> to <b>{$name}</b><br><b style=\"color:red;\">Please make sure you'll update all the widgets that are using the old model name with the renamed model name, else you'll be facing some errors when trying to load those widgets!</b>!" . (!empty($message) ? "<br/>" . nl2br($message) : ''))->console(afStudioModelCommandHelper::deploy());
}
return $response->success(false)->message("Can't rename model's phpName from <b>{$this->getModelName()}</b> to <b>{$name}</b>!");
}
示例14: __call
public function __call($method, $arguments)
{
if (substr($method, 0, 3) == 'get') {
$name = substr($method, 3, strlen($method));
$name = sfInflector::tableize($name);
return $this->get($name, $arguments);
}
}
示例15: getReadableKeywordType
public function getReadableKeywordType()
{
return sfInflector::humanize(sfInflector::tableize($this->getKeywordType()));
}