本文整理汇总了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);
}
}
示例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'];
}
示例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');
}
示例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]);
}
示例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);
}
示例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);
}
示例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');
}
示例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());
}
示例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']]]);
}
示例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);
}
示例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);
}
示例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');
}
示例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);
}
示例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);
}
示例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();
}