当前位置: 首页>>代码示例>>PHP>>正文


PHP TableRegistry::exists方法代码示例

本文整理汇总了PHP中Cake\ORM\TableRegistry::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP TableRegistry::exists方法的具体用法?PHP TableRegistry::exists怎么用?PHP TableRegistry::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\ORM\TableRegistry的用法示例。


在下文中一共展示了TableRegistry::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Sets up the configuration for the model, and loads ACL models if they haven't been already
  *
  * @param Table $model Table instance being attached
  * @param array $config Configuration
  * @return void
  */
 public function __construct(Table $model, array $config = [])
 {
     $this->_table = $model;
     if (isset($config[0])) {
         $config['type'] = $config[0];
         unset($config[0]);
     }
     if (isset($config['type'])) {
         $config['type'] = strtolower($config['type']);
     }
     parent::__construct($model, $config);
     $types = $this->_typeMaps[$this->config()['type']];
     if (!is_array($types)) {
         $types = [$types];
     }
     foreach ($types as $type) {
         $alias = Inflector::pluralize($type);
         $className = App::className($alias . 'Table', 'Model/Table');
         if ($className == false) {
             $className = App::className('Acl.' . $alias . 'Table', 'Model/Table');
         }
         $config = [];
         if (!TableRegistry::exists($alias)) {
             $config = ['className' => $className];
         }
         $model->hasMany($type, ['targetTable' => TableRegistry::get($alias, $config)]);
     }
     if (!method_exists($model->entityClass(), 'parentNode')) {
         trigger_error(__d('cake_dev', 'Callback {0} not defined in {1}', ['parentNode()', $model->entityClass()]), E_USER_WARNING);
     }
 }
开发者ID:cakephp,项目名称:acl,代码行数:38,代码来源:AclBehavior.php

示例2: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Medias') ? [] : ['className' => 'Media\\Model\\Table\\MediasTable'];
     $this->Medias = TableRegistry::get('Medias', $config);
     $this->pictures = ['jpg', 'png', 'gif', 'bmp'];
 }
开发者ID:MusicalityMaker,项目名称:CakePHP3-Media,代码行数:12,代码来源:MediaTest.php

示例3: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Bookmarks') ? [] : ['className' => 'App\\Model\\Table\\BookmarksTable'];
     $this->Bookmarks = TableRegistry::get('Bookmarks', $config);
     // parent::setUp();
     //  $this->Bookmarks = TableRegistry::get('Bookmarks');
 }
开发者ID:Harsha-Shirali,项目名称:Cakephp-3.0-and-PHPUnit-Integration,代码行数:13,代码来源:BookmarksTableTest.php

示例4: 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

示例5: setUp

 /**
  * setUp method
  *
  * It will set the needed Tables.
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Todos') ? [] : ['className' => 'App\\Model\\Table\\TodosTable'];
     $this->Todos = TableRegistry::get('Todos', $config);
     $config = TableRegistry::exists('Users') ? [] : ['className' => 'App\\Model\\Table\\UsersTable'];
     $this->Users = TableRegistry::get('Users', $config);
 }
开发者ID:pedrofs,项目名称:cakedone,代码行数:13,代码来源:TodosControllerTest.php

示例6: foreignTable

 protected function foreignTable(Token $token)
 {
     $options = [];
     if (!TableRegistry::exists($token['foreign_alias'])) {
         $options = ['table' => $token['foreign_table']];
     }
     return TableRegistry::get($token['foreign_alias'], $options);
 }
开发者ID:UseMuffin,项目名称:Tokenize,代码行数:8,代码来源:TokensTable.php

示例7: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Comments') ? [] : ['className' => 'App\\Model\\Table\\CommentsTable'];
     $this->Comments = TableRegistry::get('Comments', $config);
     $this->Comment_Reactions = TableRegistry::get('Comment_Reactions');
     $this->Users = TableRegistry::get('Users');
 }
开发者ID:CircleAround,项目名称:gbs,代码行数:13,代码来源:CommentsTableTest.php

示例8: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Times') ? [] : ['className' => 'App\\Model\\Table\\TimesTable'];
     $this->Times = TableRegistry::get('Times', $config);
     $this->CrudData = new CrudData($this->Times);
     $this->columnKeys = array_keys($this->CrudData->columns());
 }
开发者ID:OrigamiStructures,项目名称:CrudViews,代码行数:13,代码来源:CrudDataTest.php

示例9: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->image = TMP . 'testHelper.png';
     $config = TableRegistry::exists('Medias') ? [] : ['className' => 'Media\\Model\\Table\\MediasTable'];
     $this->Model = TableRegistry::get('Medias', $config);
     $this->Posts = TableRegistry::get('Posts');
     $this->Posts->addAssociations(['hasMany' => ['Media' => ['className' => 'Media.Medias', 'foreignKey' => 'ref_id', 'order' => 'Media.position ASC', 'conditions' => 'ref = "' . $this->Model->alias() . '"', 'dependant' => true]], 'belongsTo' => ['Thumb' => ['className' => 'Media.Medias', 'foreignKey' => 'media_id']]]);
 }
开发者ID:MusicalityMaker,项目名称:CakePHP3-Media,代码行数:14,代码来源:MediaBehaviorTest.php

示例10: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     TableRegistry::clear();
     $config = TableRegistry::exists('Notifications.NotificationQueue') ? [] : ['className' => 'Notifications\\Model\\Table\\NotificationQueueTable'];
     $this->NotificationQueue = TableRegistry::get('Notifications.NotificationQueues', $config);
     $config = TableRegistry::exists('Notifications.NotificationContents') ? [] : ['className' => 'Notifications\\Model\\Table\\NotificationContentsTable'];
     $this->NotificationContents = TableRegistry::get('Notifications.NotificationContents', $config);
 }
开发者ID:codekanzlei,项目名称:cake-notifications,代码行数:14,代码来源:NotificationQueuesTableTest.php

示例11: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Trackings') ? [] : ['className' => 'App\\Model\\Table\\TrackingsTable'];
     $this->Trackings = TableRegistry::get('Trackings', $config);
     $config = TableRegistry::exists('Todos') ? [] : ['className' => 'App\\Model\\Table\\TodosTable'];
     $this->Todos = TableRegistry::get('Todos', $config);
     $this->Trackable = new TrackableBehavior($this->Todos);
 }
开发者ID:pedrofs,项目名称:cakedone,代码行数:14,代码来源:TrackableBehaviorTest.php

示例12: __construct

 /**
  * Configure the instance
  *
  */
 public function __construct()
 {
     if (defined('PHPUNIT_TESTSUITE') == 1) {
         return;
     }
     // $this->NotificationQueue = \Cake\Orm\TableRegistry::get('Notifications.NotificationQueue');
     $config = TableRegistry::exists('NotificationQueue') ? [] : ['className' => 'Notifications\\Model\\Table\\NotificationQueueTable'];
     $this->NotificationQueue = TableRegistry::get('NotificationQueue', $config);
     $this->Users = TableRegistry::get('Users');
 }
开发者ID:wolfgang-braun,项目名称:cake-relay,代码行数:14,代码来源:NotificationHandler.php

示例13: setUp

 /**
  * SetUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('UsersTypeMissions') ? [] : ['className' => 'App\\Model\\Table\\UsersTypeMissionsTable'];
     $this->UsersTypeMissions = TableRegistry::get('UsersTypeMissions', $config);
     $config = TableRegistry::exists('Users') ? [] : ['className' => 'App\\Model\\Table\\UsersTable'];
     $this->Users = TableRegistry::get('Users', $config);
     $config = TableRegistry::exists('Visits') ? [] : ['className' => 'App\\Model\\Table\\VisitsTable'];
     $this->Visits = TableRegistry::get('Visits', $config);
 }
开发者ID:fxleblanc,项目名称:Website,代码行数:15,代码来源:UsersControllerTest.php

示例14: setUp

 /**
  * SetUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $config = TableRegistry::exists('Projects') ? [] : ['className' => 'App\\Model\\Table\\ProjectsTable'];
     $this->Projects = TableRegistry::get('Projects', $config);
     $config = TableRegistry::exists('Organizations') ? [] : ['className' => 'App\\Model\\Table\\OrganizationsTable'];
     $this->Organizations = TableRegistry::get('Organizations', $config);
     $config = TableRegistry::exists('Users') ? [] : ['className' => 'App\\Model\\Table\\UsersTable'];
     $this->Users = TableRegistry::get('Users', $config);
 }
开发者ID:jenwei,项目名称:Website,代码行数:15,代码来源:ProjectsTableTest.php

示例15: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     $config = [];
     if (!TableRegistry::exists('Permissions')) {
         $config = ['className' => App::className('Acl.PermissionsTable', 'Model/Table')];
     }
     $this->Permission = TableRegistry::get('Permissions', $config);
     $this->Aro = $this->Permission->Aros->target();
     $this->Aco = $this->Permission->Acos->target();
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:14,代码来源:DbAcl.php


注:本文中的Cake\ORM\TableRegistry::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。