本文整理匯總了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');
}
示例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();
}
}
示例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');
}
示例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');
}
示例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();
}
}
}
}
}
示例6: isClient
public function isClient()
{
if ($this->getUserType() == 'client') {
return Doctrine_Core::getTable('Client')->getByUserId($this->getId());
}
return false;
}
示例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()');
}
}
示例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');
}
示例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');
}
示例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');
}
示例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;
}
示例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);
}
示例13: getByLink
public static function getByLink($link)
{
if ($link == '') {
return self::findList()->execute();
}
return Doctrine_Core::getTable('Aktual')->findOneByLink($link);
}
示例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);
}
}
示例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;
}