當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityInterface::source方法代碼示例

本文整理匯總了PHP中Cake\Datasource\EntityInterface::source方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityInterface::source方法的具體用法?PHP EntityInterface::source怎麽用?PHP EntityInterface::source使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Datasource\EntityInterface的用法示例。


在下文中一共展示了EntityInterface::source方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tagsChooser

 /**
  * Render a multi select with all available tags of entity and the tags of attachment preselected
  *
  * @param  EntityInterface                    $entity     the entity to get all allowed tags from
  * @param  Attachment\Model\Entity\Attachment $attachment the attachment entity to add the tag to
  * @return string
  */
 public function tagsChooser(EntityInterface $entity, $attachment)
 {
     if (!TableRegistry::exists($entity->source())) {
         throw new Cake\Network\Exception\MissingTableException('Could not find Table ' . $entity->source());
     }
     $Table = TableRegistry::get($entity->source());
     return $this->Form->select('tags', $Table->getAttachmentsTags(), ['type' => 'select', 'class' => 'tag-chooser', 'style' => 'display: block; width: 100%', 'label' => false, 'multiple' => true, 'value' => $attachment->tags]);
 }
開發者ID:cleptric,項目名稱:cake-attachments,代碼行數:15,代碼來源:AttachmentsHelper.php

示例2: toggle

 public function toggle(EntityInterface $entity)
 {
     $limit = $this->config('implementedServices.' . $entity->source())->config('limit');
     if ($limit !== 1) {
         throw new Exception(sprintf('Toggle disabled, type "%s" limit is "%s"', $entity->source(), $limit));
     }
     // if current user in $entity->reviewed_by
     // if so goto unreview
     // else goto review
 }
開發者ID:jadb,項目名稱:muffin-reviews,代碼行數:10,代碼來源:ReviewsBehavior.php

示例3: _repository

 /**
  * Gets the repository for this entity
  *
  * @param EntityInterface $entity
  * @return Table
  */
 protected function _repository($entity)
 {
     $source = $entity->source();
     if ($source === null) {
         list(, $class) = namespaceSplit(get_class($entity));
         $source = Inflector::pluralize($class);
     }
     return TableRegistry::get($source);
 }
開發者ID:cakeplugins,項目名稱:api,代碼行數:15,代碼來源:TransformerAbstract.php

示例4: __getFileName

 /**
  * recursive method to increase the filename in case the file already exists
  *
  * @param string $fileInfo Array of information about the file
  * @param EntityInterface $entity Entity
  * @param string $id counter varibale to extend the filename
  * @return array
  */
 private function __getFileName($fileInfo, EntityInterface $entity, $id = 0)
 {
     if (!file_exists(Configure::read('Attachments.path') . $entity->source() . '/' . $entity->id . '/' . $fileInfo['basename'])) {
         return $fileInfo;
     }
     $fileInfo['basename'] = $fileInfo['filename'] . ' (' . ++$id . ').' . $fileInfo['extension'];
     return $this->__getFileName($fileInfo, $entity, $id);
 }
開發者ID:cleptric,項目名稱:cake-attachments,代碼行數:16,代碼來源:AttachmentsTable.php

示例5: _getTableAlias

 /**
  * Get table alias for the given entity.
  *
  * @param \Cake\Datasource\EntityInterface $entity The entity
  * @return string Table alias
  */
 protected function _getTableAlias(EntityInterface $entity)
 {
     $alias = $entity->source();
     if (mb_strpos($alias, '.') !== false) {
         $parts = explode('.', $alias);
         $alias = array_pop($parts);
     }
     return strtolower($alias);
 }
開發者ID:quickapps-plugins,項目名稱:comment,代碼行數:15,代碼來源:CommentComponent.php

示例6: deleteButton

 /**
  * Renders an delete button
  *
  * @param EntityInterface $entity Entity to take the ID from
  * @param array $options Config options
  * @return string
  */
 public function deleteButton(EntityInterface $entity, array $options = [])
 {
     $options = Hash::merge(['url' => null, 'title' => __d('cktools', 'delete'), 'icon' => 'fa fa-trash-o', 'class' => 'btn btn-danger btn-xs', 'confirm' => __d('cktools', 'delete_confirmation')], $options);
     $url = $options['url'];
     $title = $options['title'];
     $icon = $options['icon'];
     unset($options['url'], $options['title'], $options['icon']);
     if (!$url) {
         $url = ['controller' => $entity->source(), 'action' => 'delete', $entity->id];
     }
     if ($icon) {
         $title = '<i class="' . $icon . '"></i> ' . '<span class="button-text">' . $title . '</span>';
         $options['escape'] = false;
     }
     return $this->Html->link($title, $url, $options);
 }
開發者ID:kiliansch,項目名稱:cake-cktools,代碼行數:23,代碼來源:CkToolsHelper.php

示例7: __invoke

 public function __invoke(EntityInterface $row)
 {
     $primaryKey = array_values($row->extract((array) $this->table->primaryKey()));
     $row->_links = ['self' => ['href' => Router::url(['controller' => $row->source(), 'action' => 'view'] + $primaryKey)]];
     return $this->enrich($row);
 }
開發者ID:surjit,項目名稱:cakephp3-advanced-examples,代碼行數:6,代碼來源:LinksEnricher.php

示例8: deleteButton

 /**
  * Renders an delete button
  *
  * @param EntityInterface $entity Entity to take the ID from
  * @param array $options Config options
  * @return string
  */
 public function deleteButton(EntityInterface $entity, array $options = [])
 {
     $options = Hash::merge(['url' => null, 'title' => __d('cktools', 'delete'), 'icon' => 'fa fa-trash-o', 'class' => 'btn btn-danger btn-xs', 'confirm' => __d('cktools', 'delete_confirmation'), 'usePostLink' => false], $options);
     $url = $options['url'];
     $title = $options['title'];
     $icon = $options['icon'];
     unset($options['url'], $options['title'], $options['icon']);
     if (!$url) {
         list($plugin, $controller) = pluginSplit($entity->source());
         $url = ['plugin' => $this->_View->request->plugin, 'controller' => $controller, 'action' => 'delete', $entity->id];
     }
     if ($icon) {
         $title = '<i class="' . $icon . '"></i> ' . '<span class="button-text">' . $title . '</span>';
         $options['escape'] = false;
     }
     if ($options['usePostLink']) {
         return $this->Form->postLink($title, $url, $options);
     } else {
         return $this->Html->link($title, $url, $options);
     }
 }
開發者ID:codekanzlei,項目名稱:cake-cktools,代碼行數:28,代碼來源:CkToolsHelper.php


注:本文中的Cake\Datasource\EntityInterface::source方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。