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


PHP Doctrine_Core::getTable方法代碼示例

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


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

示例1: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($frequency = Doctrine_Core::getTable('Frequency')->find(array($request->getParameter('frequency_id'))), sprintf('Object frequency does not exist (%s).', $request->getParameter('frequency_id')));
     $frequency->delete();
     $this->redirect('frequency/index');
 }
開發者ID:hunde,項目名稱:bsc,代碼行數:7,代碼來源:actions.class.php

示例2: postAction

 public function postAction()
 {
     $email = $this->_request->getParam('email');
     $response = $this->_helper->response();
     if (Kebab_Validation_Email::isValid($email)) {
         // Create user object
         $user = Doctrine_Core::getTable('Model_Entity_User')->findOneBy('email', $email);
         $password = Kebab_Security::createPassword();
         if ($user !== false) {
             $user->password = md5($password);
             $user->save();
             $configParam = Zend_Registry::get('config')->kebab->mail;
             $smtpServer = $configParam->smtpServer;
             $config = $configParam->config->toArray();
             // Mail phtml
             $view = new Zend_View();
             $view->setScriptPath(APPLICATION_PATH . '/views/mails/');
             $view->assign('password', $password);
             $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
             $mail = new Zend_Mail('UTF-8');
             $mail->setFrom($configParam->from, 'Kebab Project');
             $mail->addTo($user->email, $user->fullName);
             $mail->setSubject('Reset Password');
             $mail->setBodyHtml($view->render('forgot-password.phtml'));
             $mail->send($transport);
             $response->setSuccess(true)->getResponse();
         } else {
             $response->addNotification(Kebab_Notification::ERR, 'There isn\'t user with this email')->getResponse();
         }
     } else {
         $response->addError('email', 'Invalid email format')->getResponse();
     }
 }
開發者ID:esironal,項目名稱:kebab-project,代碼行數:33,代碼來源:ForgotPasswordController.php

示例3: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($scss_troop_enrollment = Doctrine_Core::getTable('ScssTroopEnrollment')->find(array($request->getParameter('id'))), sprintf('Object scss_troop_enrollment does not exist (%s).', $request->getParameter('id')));
     $scss_troop_enrollment->delete();
     $this->redirect('troopEnrollment/index');
 }
開發者ID:ner0tic,項目名稱:scss,代碼行數:7,代碼來源:actions.class.php

示例4: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($student_center = Doctrine_Core::getTable('StudentCenter')->find(array($request->getParameter('id'))), sprintf('Object student_center does not exist (%s).', $request->getParameter('id')));
     $student_center->delete();
     $this->redirect('studentcenter/index');
 }
開發者ID:eyumay,項目名稱:srms.psco,代碼行數:7,代碼來源:actions.class.php

示例5: executeSave_slots

 public function executeSave_slots(sfWebRequest $request)
 {
     $this->contentSlots = array();
     $this->failedContentSlots = array();
     $this->errors = array();
     $slotIds = $request->getParameter('slot_ids');
     $contentIds = $request->getParameter('content_ids');
     foreach ($slotIds as $slotId) {
         $content = Doctrine_Core::getTable('sfSympalContent')->find($contentIds[$slotId]);
         $contentSlot = Doctrine_Core::getTable('sfSympalContentSlot')->find($slotId);
         $contentSlot->setContentRenderedFor($content);
         $form = $contentSlot->getEditForm();
         $form->bind($request->getParameter($form->getName()));
         if ($form->isValid()) {
             if ($request->getParameter('preview')) {
                 $form->updateObject();
             } else {
                 $form->save();
             }
             $this->contentSlots[] = $contentSlot;
         } else {
             $this->failedContentSlots[] = $contentSlot;
             foreach ($form as $name => $field) {
                 if ($field->hasError()) {
                     $this->errors[$contentSlot->getName()] = $field->getError();
                 }
             }
         }
     }
 }
開發者ID:slemoigne,項目名稱:sympal,代碼行數:30,代碼來源:Basesympal_edit_slotActions.class.php

示例6: isClient

 public function isClient()
 {
     if ($this->getUserType() == 'client') {
         return Doctrine_Core::getTable('Client')->getByUserId($this->getId());
     }
     return false;
 }
開發者ID:nidhhoggr,項目名稱:supra,代碼行數:7,代碼來源:myUser.class.php

示例7: __construct

 public function __construct($modelName, $alias = null)
 {
     if (is_string($modelName)) {
         $this->_modelName = $modelName;
         $query = Doctrine_Core::getTable($modelName)->createQuery($alias);
         $this->_query = $query;
         $this->_pager = new sfDoctrinePager($this->_modelName);
         $this->_pager->setQuery($this->_query);
     } else {
         if ($modelName instanceof Doctrine_Query) {
             $this->_query = $modelName;
             $this->_query->getSqlQuery(array(), false);
             $this->_modelName = $this->_query->getRoot()->getOption('name');
             $this->_pager = new sfDoctrinePager($this->_modelName);
             $this->_pager->setQuery($this->_query);
         } else {
             if ($modelName instanceof sfDoctrinePager) {
                 $this->_pager = $modelName;
                 $this->_query = $this->_pager->getQuery();
                 $this->_query->getSqlQuery(array(), false);
                 $this->_modelName = $this->_query->getRoot()->getOption('name');
             } else {
                 throw new Doctrine_Exception('First argument should be either the name of a model or an existing Doctrine_Query object');
             }
         }
     }
     $this->_table = Doctrine_Core::getTable($this->_modelName);
     if (!self::$_symfonyContext) {
         throw new sfException('In order to use the Sympal data grid you must set the Symfony context to use with setSymfonyContext()');
     }
 }
開發者ID:slemoigne,項目名稱:sympal,代碼行數:31,代碼來源:sfSympalDataGrid.class.php

示例8: executeChangestatus

 public function executeChangestatus()
 {
     $object = Doctrine_Core::getTable('mycvExperiences')->findOneById($this->getRequestParameter('id'));
     $object->changeStatus();
     $this->getUser()->setFlash('notice', 'Status was modified successfully');
     $this->redirect('@nd_adminExperiences');
 }
開發者ID:ndachez,項目名稱:dachez,代碼行數:7,代碼來源:actions.class.php

示例9: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($account_invoice = Doctrine_Core::getTable('AccountInvoice')->find(array($request->getParameter('id'))), sprintf('Object account_invoice does not exist (%s).', $request->getParameter('id')));
     $account_invoice->delete();
     $this->redirect('invoice/index');
 }
開發者ID:nidhhoggr,項目名稱:supra,代碼行數:7,代碼來源:actions.class.php

示例10: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($scss_course = Doctrine_Core::getTable('ScssCourse')->find(array($request->getParameter('id'))), sprintf('Object scss_course does not exist (%s).', $request->getParameter('id')));
     $scss_course->delete();
     $this->redirect('course/index');
 }
開發者ID:ner0tic,項目名稱:scss,代碼行數:7,代碼來源:actions.class.php

示例11: getChoices

 public function getChoices()
 {
     $choices = array();
     if (false !== $this->getOption('add_empty')) {
         $choices[''] = true === $this->getOption('add_empty') ? '' : $this->getOption('add_empty');
     }
     if (null === $this->getOption('table_method')) {
         $query = null === $this->getOption('query') ? Doctrine_Core::getTable($this->getOption('model'))->createQuery() : $this->getOption('query');
         $query->addOrderBy('root_id asc')->addOrderBy('lft asc');
         $objects = $query->execute();
     } else {
         $tableMethod = $this->getOption('table_method');
         $results = Doctrine_Core::getTable($this->getOption('model'))->{$tableMethod}();
         if ($results instanceof Doctrine_Query) {
             $objects = $results->execute();
         } else {
             if ($results instanceof Doctrine_Collection) {
                 $objects = $results;
             } else {
                 if ($results instanceof Doctrine_Record) {
                     $objects = new Doctrine_Collection($this->getOption('model'));
                     $objects[] = $results;
                 } else {
                     $objects = array();
                 }
             }
         }
     }
     $method = $this->getOption('method');
     $keyMethod = $this->getOption('key_method');
     foreach ($objects as $object) {
         $choices[$object->{$keyMethod}()] = str_repeat(' ', $object['level'] * 4) . $object->{$method}();
     }
     return $choices;
 }
開發者ID:228vit,項目名稱:sftree,代碼行數:35,代碼來源:sfWidgetFormDoctrineChoiceNestedSet.class.php

示例12: testColumnAggregation

 public function testColumnAggregation()
 {
     $animal = Doctrine_Core::getTable('mkNode')->findOneById(1);
     $this->assertTrue($animal instanceof mkAnimal);
     $plant = Doctrine_Core::getTable('mkOrganism')->findOneById(2);
     $this->assertTrue($plant instanceof mkPlant);
 }
開發者ID:dennybrandes,項目名稱:doctrine1,代碼行數:7,代碼來源:2015TestCase.php

示例13: getByLink

 public static function getByLink($link)
 {
     if ($link == '') {
         return self::findList()->execute();
     }
     return Doctrine_Core::getTable('Aktual')->findOneByLink($link);
 }
開發者ID:jager,項目名稱:cms,代碼行數:7,代碼來源:Aktual.php

示例14: execute

 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     if (!$options['skip-build']) {
         $buildModel = new sfDoctrineBuildModelTask($this->dispatcher, $this->formatter);
         $buildModel->setCommandApplication($this->commandApplication);
         $buildModel->setConfiguration($this->configuration);
         $buildModel->run();
     }
     $connections = array();
     $models = $arguments['models'];
     foreach ($models as $key => $model) {
         $model = trim($model);
         $conn = Doctrine_Core::getTable($model)->getConnection();
         $connections[$conn->getName()][] = $model;
     }
     foreach ($connections as $name => $models) {
         $this->logSection('doctrine', 'dropping model tables for connection "' . $name . '"');
         $conn = Doctrine_Manager::getInstance()->getConnection($name);
         $models = $conn->unitOfWork->buildFlushTree($models);
         $models = array_reverse($models);
         foreach ($models as $model) {
             $tableName = Doctrine_Core::getTable($model)->getOption('tableName');
             $this->logSection('doctrine', 'dropping table "' . $tableName . '"');
             try {
                 $conn->export->dropTable($tableName);
             } catch (Exception $e) {
                 $this->logSection('doctrine', 'dropping table failed: ' . $e->getMessage());
             }
         }
         $this->logSection('doctrine', 'recreating tables for models');
         Doctrine_Core::createTablesFromArray($models);
     }
 }
開發者ID:Phennim,項目名稱:symfony1,代碼行數:34,代碼來源:sfDoctrineCreateModelTablesTask.class.php

示例15: getChoices

 /**
  * Returns the choices associated to the model.
  *
  * @return array An array of choices
  */
 public function getChoices()
 {
     $choices = array();
     if (false !== $this->getOption('add_empty')) {
         $choices[''] = true === $this->getOption('add_empty') ? '' : $this->getOption('add_empty');
     }
     if (null === $this->getOption('table_method')) {
         $query = null === $this->getOption('query') ? Doctrine_Core::getTable($this->getOption('model'))->createQuery() : $this->getOption('query');
         if ($order = $this->getOption('order_by')) {
             $query->addOrderBy($order[0] . ' ' . $order[1]);
         }
         $objects = $query->execute();
     } else {
         $results = $this->callTableMethod();
         if ($results instanceof Doctrine_Query) {
             $objects = $results->execute();
         } elseif ($results instanceof Doctrine_Collection) {
             $objects = $results;
         } elseif ($results instanceof Doctrine_Record) {
             $objects = new Doctrine_Collection($this->getOption('model'));
             $objects[] = $results;
         } elseif (is_array($results)) {
             $results = array_replace($choices, $results);
             return $results;
         } else {
             $objects = array();
         }
     }
     $method = $this->getOption('method');
     $keyMethod = $this->getOption('key_method');
     foreach ($objects as $object) {
         $choices[$object->{$keyMethod}()] = $object->{$method}();
     }
     return $choices;
 }
開發者ID:naturalsciences,項目名稱:Darwin,代碼行數:40,代碼來源:sfWidgetFormDarwinDoctrineChoice.class.php


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