public function executeMenu() { $this->setLayout(false); $con = Propel::getConnection(); $year = date("Y"); $years = array(); $sql = "SELECT DISTINCT MONTH(start_date) AS month FROM m_news WHERE start_date LIKE '" . $year . "%'"; $stmt = $con->createStatement(); $rs = $stmt->executeQuery($sql); while ($rs->next()) { $months[] = $rs->get("month"); } $con = Propel::getConnection(); $year = date("Y"); $sql = "SELECT DISTINCT YEAR(start_date) AS year FROM m_news"; $stmt = $con->createStatement(); $rs = $stmt->executeQuery($sql); while ($rs->next()) { $years[$rs->get("year")] = $rs->get("year"); } unset($years[$year]); if (!empty($years)) { $this->pastYears = $years; } $this->monthsArr = array(1 => "january", 2 => "february", 3 => "march", 4 => "april", 5 => "may", 6 => "june", 7 => "july", 8 => "august", 9 => "september", 10 => "october", 11 => "november", 12 => "december"); //UtilsHelper::Date() $this->months = $months; $this->getRequestParameter("month") ? $this->currentMonth = $this->getRequestParameter("month") : ($this->currentMonth = date("n")); $this->currentYear = $year; }
/** * @see sfPluginConfiguration */ public function initialize() { sfConfig::set('sf_orm', 'propel'); if (!sfConfig::get('sf_admin_module_web_dir')) { sfConfig::set('sf_admin_module_web_dir', '/sfPropelPlugin'); } sfToolkit::addIncludePath(array(sfConfig::get('sf_root_dir'), sfConfig::get('sf_propel_runtime_path', realpath(dirname(__FILE__) . '/../lib/vendor')))); require_once 'propel/Propel.php'; if (!Propel::isInit()) { if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { Propel::setLogger(new sfPropelLogger($this->dispatcher)); } $propelConfiguration = new PropelConfiguration(); Propel::setConfiguration($propelConfiguration); $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure')); Propel::initialize(); } $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent')); if (sfConfig::get('sf_web_debug')) { $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent')); } if (sfConfig::get('sf_test')) { $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools')); } }
public static function getPopularTags($max = 30) { $connection = Propel::getConnection(); $query = 'SELECT %s as query, COUNT(*) as count FROM %s INNER JOIN %s ON %s = %s INNER JOIN %s ON %s = %s WHERE %s = %s GROUP BY query ORDER BY count DESC'; $query = sprintf($query, QueryPeer::QUERY, QueryPeer::TABLE_NAME, ReportQueryPeer::TABLE_NAME, QueryPeer::ID, ReportQueryPeer::QUERY_ID, ReportPeer::TABLE_NAME, ReportQueryPeer::REPORT_ID, ReportPeer::ID, ReportPeer::PUBLIC_RECORD, true); $statement = $connection->prepareStatement($query); $statement->setLimit($max); $resultset = $statement->executeQuery(); $tags = array(); $max_count = 0; while ($resultset->next()) { if (!$max_count) { $max_count = $resultset->getInt('count'); } $queries[] = array('query' => $resultset->getString('query'), 'rank' => floor($resultset->getInt('count') / $max_count * 9 + 1), 'count' => $resultset->getInt('count')); } ksort($queries); return $queries; }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap('workflow'); $tMap = $this->dbMap->addTable('APP_DELEGATION'); $tMap->setPhpName('AppDelegation'); $tMap->setUseIdGenerator(false); $tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addPrimaryKey('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('DEL_PREVIOUS', 'DelPrevious', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('DEL_LAST_INDEX', 'DelLastIndex', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('PRO_UID', 'ProUid', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('DEL_TYPE', 'DelType', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('DEL_THREAD', 'DelThread', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('DEL_THREAD_STATUS', 'DelThreadStatus', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('DEL_PRIORITY', 'DelPriority', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('DEL_DELEGATE_DATE', 'DelDelegateDate', 'int', CreoleTypes::TIMESTAMP, true, null); $tMap->addColumn('DEL_INIT_DATE', 'DelInitDate', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('DEL_TASK_DUE_DATE', 'DelTaskDueDate', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('DEL_FINISH_DATE', 'DelFinishDate', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('DEL_DURATION', 'DelDuration', 'double', CreoleTypes::DOUBLE, false, null); $tMap->addColumn('DEL_QUEUE_DURATION', 'DelQueueDuration', 'double', CreoleTypes::DOUBLE, false, null); $tMap->addColumn('DEL_DELAY_DURATION', 'DelDelayDuration', 'double', CreoleTypes::DOUBLE, false, null); $tMap->addColumn('DEL_STARTED', 'DelStarted', 'int', CreoleTypes::TINYINT, false, null); $tMap->addColumn('DEL_FINISHED', 'DelFinished', 'int', CreoleTypes::TINYINT, false, null); $tMap->addColumn('DEL_DELAYED', 'DelDelayed', 'int', CreoleTypes::TINYINT, false, null); $tMap->addColumn('DEL_DATA', 'DelData', 'string', CreoleTypes::LONGVARCHAR, true, null); $tMap->addColumn('APP_OVERDUE_PERCENTAGE', 'AppOverduePercentage', 'double', CreoleTypes::DOUBLE, true, null); $tMap->addValidator('DEL_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|PARALLEL', 'Please select a valid status.'); $tMap->addValidator('DEL_PRIORITY', 'validValues', 'propel.validator.ValidValuesValidator', '1|2|3|4|5', 'Please select a valid Priority.'); $tMap->addValidator('DEL_THREAD_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'CLOSED|OPEN|PAUSED', 'Please select a valid status.'); }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(AfaOrgPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(AfaOrgPeer::TABLE_NAME); $tMap->setPhpName('AfaOrg'); $tMap->setClassname('AfaOrg'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, 11); $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 60); $tMap->addColumn('ORG_PHONE', 'OrgPhone', 'VARCHAR', false, 16); $tMap->addColumn('HOME_PAGE_URL', 'HomePageUrl', 'VARCHAR', false, 80); $tMap->addColumn('ORG_FAX', 'OrgFax', 'VARCHAR', false, 16); $tMap->addColumn('REF_CONTACT_NAME', 'RefContactName', 'VARCHAR', false, 25); $tMap->addColumn('REF_CONTACT_EMAIL', 'RefContactEmail', 'VARCHAR', false, 80); $tMap->addColumn('VPO_SOAP_SERVER_URL', 'VpoSoapServerUrl', 'VARCHAR', false, 125); $tMap->addColumn('VPO_REQUEST_POST_EMAIL', 'VpoRequestPostEmail', 'VARCHAR', false, 125); $tMap->addColumn('VPO_USER_ID', 'VpoUserId', 'VARCHAR', false, 25); $tMap->addColumn('VPO_USER_PASSWORD', 'VpoUserPassword', 'VARCHAR', false, 25); $tMap->addColumn('VPO_ORG_ID', 'VpoOrgId', 'VARCHAR', false, 5); $tMap->addColumn('AFIDS_REQUESTER_USER_NAME', 'AfidsRequesterUserName', 'VARCHAR', false, 25); $tMap->addColumn('AFIDS_REQUESTER_PASSWORD', 'AfidsRequesterPassword', 'VARCHAR', false, 25); $tMap->addColumn('AFIDS_SOAP_SERVER_URL', 'AfidsSoapServerUrl', 'VARCHAR', false, 125); $tMap->addColumn('AFIDS_REQUEST_POST_EMAIL', 'AfidsRequestPostEmail', 'VARCHAR', false, 125); $tMap->addColumn('PHONE_NUMBER1', 'PhoneNumber1', 'VARCHAR', false, 16); $tMap->addColumn('PHONE_NUMBER2', 'PhoneNumber2', 'VARCHAR', false, 16); }
public function executeSidebar(sfWebRequest $request) { $route = sfContext::getInstance()->getRouting()->getCurrentRouteName(); $this->route = $route; $id = $request->getParameter('catalogId'); $stm = Propel::getConnection()->prepare(' SELECT title,id FROM category WHERE parent_id=4 '); $stm->execute(); $menu = $stm->fetchAll(PDO::FETCH_OBJ); $this->menu = $menu; $stm = Propel::getConnection()->prepare(' SELECT title,id FROM category_has_product INNER JOIN product ON product.id = category_has_product.product_id WHERE category_has_product.category_id = :id '); $stm->bindParam(':id', $id); $stm->execute(); $product = $stm->fetchAll(PDO::FETCH_OBJ); $this->product = $product; }
public function testInvalidCharset() { $this->markTestSkipped(); $db = Propel::getDB(BookPeer::DATABASE_NAME); if ($db instanceof DBSQLite) { $this->markTestSkipped(); } $a = new Author(); $a->setFirstName("Б."); $a->setLastName("АКУНИН"); $a->save(); $authorNameWindows1251 = iconv("utf-8", "windows-1251", $a->getLastName()); $a->setLastName($authorNameWindows1251); // Different databases seem to handle invalid data differently (no surprise, I guess...) if ($db instanceof DBPostgres) { try { $a->save(); $this->fail("Expected an exception when saving non-UTF8 data to database."); } catch (Exception $x) { print $x; } } else { // No exception is thrown by MySQL ... (others need to be tested still) $a->save(); $a->reload(); $this->assertEquals("", $a->getLastName(), "Expected last_name to be empty (after inserting invalid charset data)"); } }
/** * Inserts the menu links related to the inserted content, * into the w3sMenuElements table * * @return bool * */ protected function setDefaultRelatedElements() { $bRollBack = false; $con = Propel::getConnection(); $con = w3sPropelWorkaround::beginTransaction($con); for ($i = 1; $i < 4; $i++) { $newMenu = new W3sMenuElement(); $contentValues = array("ContentId" => $this->content->getId(), "PageId" => 0, "Link" => w3sCommonFunctions::toI18n('This is a link'), "ExternalLink" => '', "Image" => '', "RolloverImage" => '', "Position" => $i); $newMenu->fromArray($contentValues); $result = $newMenu->save(); if ($newMenu->isModified() && $result == 0) { $bRollBack = true; break; } } if (!$bRollBack) { // Everything was fine so W3StudioCMS commits to database $con->commit(); $result = true; } else { // Something was wrong so W3StudioCMS aborts the operation and restores to previous status w3sPropelWorkaround::rollBack($con); $result = false; } }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(MissionReportPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(MissionReportPeer::TABLE_NAME); $tMap->setPhpName('MissionReport'); $tMap->setClassname('MissionReport'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, 4); $tMap->addColumn('REPORT_DATE', 'ReportDate', 'TIMESTAMP', false, null); $tMap->addColumn('MISSION_DATE', 'MissionDate', 'TIMESTAMP', false, null); $tMap->addColumn('COPILOT_NAME', 'CopilotName', 'VARCHAR', false, 50); $tMap->addColumn('MEMBER_COPILOT', 'MemberCopilot', 'TINYINT', false, 1); $tMap->addForeignKey('AIRCRAFT_ID', 'AircraftId', 'INTEGER', 'aircraft', 'ID', false, 4); $tMap->addColumn('N_NUMBER', 'NNumber', 'VARCHAR', false, 8); $tMap->addColumn('MAKEMODEL', 'Makemodel', 'VARCHAR', false, 60); $tMap->addColumn('HOBBS_TIME', 'HobbsTime', 'TIME', false, null); $tMap->addColumn('PASSENGER_NAMES', 'PassengerNames', 'VARCHAR', false, 255); $tMap->addColumn('MISSION_COMMENTS', 'MissionComments', 'LONGVARCHAR', false, null); $tMap->addColumn('EXPENSE_REPORT', 'ExpenseReport', 'LONGVARCHAR', false, null); $tMap->addColumn('APPROVED', 'Approved', 'TINYINT', false, 1); $tMap->addColumn('PICKUP_AIRPORT_IDENT', 'PickupAirportIdent', 'VARCHAR', false, 25); $tMap->addColumn('DROPOFF_AIRPORT_IDENT', 'DropoffAirportIdent', 'VARCHAR', false, 25); $tMap->addColumn('ROUTING', 'Routing', 'VARCHAR', false, 40); $tMap->addColumn('COMMERCIAL_TICKET_COST', 'CommercialTicketCost', 'INTEGER', false, 8); $tMap->addColumn('AIRLINE_REF_NUMBER', 'AirlineRefNumber', 'VARCHAR', false, 40); $tMap->addColumn('AIRLINE_OWRT', 'AirlineOwrt', 'VARCHAR', false, 2); $tMap->addColumn('MILEAGE', 'Mileage', 'INTEGER', false, 4); $tMap->addColumn('PHOTO1', 'Photo1', 'VARCHAR', false, 255); $tMap->addColumn('PHOTO2', 'Photo2', 'VARCHAR', false, 255); $tMap->addColumn('PHOTO3', 'Photo3', 'VARCHAR', false, 255); $tMap->addColumn('PHOTO4', 'Photo4', 'VARCHAR', false, 255); $tMap->addColumn('PHOTO5', 'Photo5', 'VARCHAR', false, 255); }
public function testExplainPlanFromString() { BookstoreDataPopulator::depopulate($this->con); BookstoreDataPopulator::populate($this->con); $db = Propel::getDb(BookPeer::DATABASE_NAME); $query = 'SELECT book.TITLE AS Title FROM book INNER JOIN author ON (book.AUTHOR_ID=author.ID) WHERE author.FIRST_NAME = \'Neal\''; $stmt = $db->doExplainPlan($this->con, $query); $explain = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($db instanceof DBMySQL) { $this->assertEquals(sizeof($explain), 2, 'Explain plan return two lines'); // explain can change sometime, test can't be strict $this->assertArrayHasKey('select_type', $explain[0], 'Line 1, select_type key exist'); $this->assertArrayHasKey('table', $explain[0], 'Line 1, table key exist'); $this->assertArrayHasKey('type', $explain[0], 'Line 1, type key exist'); $this->assertArrayHasKey('possible_keys', $explain[0], 'Line 1, possible_keys key exist'); $this->assertArrayHasKey('select_type', $explain[1], 'Line 2, select_type key exist'); $this->assertArrayHasKey('table', $explain[1], 'Line 2, table key exist'); $this->assertArrayHasKey('type', $explain[1], 'Line 2, type key exist'); $this->assertArrayHasKey('possible_keys', $explain[1], 'Line 2, possible_keys key exist'); } elseif ($db instanceof DBOracle) { $this->assertTrue(sizeof($explain) > 2, 'Explain plan return more than 2 lines'); } else { $this->markTestSkipped('Cannot test explain plan on adapter ' . get_class($db)); } }
/** * Copies the menu links for the sourceContent to the targetContent * * @parameter int The id of the source content * @parameter int The id of the target content * * @return bool false - The save operation has failed * true - The save operation has correctly done */ public static function copyRelatedElements($sourceContent, $targetContent) { $bRollBack = false; $con = Propel::getConnection(); $con = w3sPropelWorkaround::beginTransaction($con); // Deletes all the target menus $targetMenus = W3sMenuElementPeer::getContentMenu($targetContent); foreach ($targetMenus as $targetMenu) { $targetMenu->delete(); } // Retrieves the menu rows related to source content $sourceMenus = DbFinder::from('W3sMenuElement')->where('contentId', $sourceContent)->orderBy('position')->find(); foreach ($sourceMenus as $sourceMenu) { $oTargetMenu = new W3sMenuElement(); $contentValues = array("ContentId" => $targetContent, "PageId" => $sourceMenu->getPageId(), "Link" => $sourceMenu->getLink(), "ExternalLink" => $sourceMenu->getExternalLink(), "Image" => $sourceMenu->getImage(), "RolloverImage" => $sourceMenu->getRolloverImage(), "Position" => $sourceMenu->getPosition()); $oTargetMenu->fromArray($contentValues); // Saves $result = $oTargetMenu->save(); if ($oTargetMenu->isModified() && $result == 0) { $bRollBack = true; break; } } if (!$bRollBack) { // Everything was fine so W3StudioCMS commits to database $con->commit(); $result = true; } else { // Something was wrong so W3StudioCMS aborts the operation and restores to previous status w3sPropelWorkaround::rollBack($con); $result = false; } return $result; }
public function doBuild() { $this->dbMap = Propel::getDatabaseMap('propel'); $tMap = $this->dbMap->addTable('student'); $tMap->setPhpName('Student'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('CODE', 'Code', 'string', CreoleTypes::VARCHAR, false, 64); $tMap->addColumn('CODE2', 'Code2', 'string', CreoleTypes::VARCHAR, false, 64); $tMap->addColumn('CODE3', 'Code3', 'string', CreoleTypes::VARCHAR, false, 64); $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('CURRICULUM_ID', 'CurriculumId', 'int', CreoleTypes::INTEGER, 'curriculum', 'ID', false, null); $tMap->addForeignKey('ACADEMIC_CALENDAR_ID', 'AcademicCalendarId', 'int', CreoleTypes::INTEGER, 'academic_calendar', 'ID', false, null); $tMap->addForeignKey('CLASS_GROUP_ID', 'ClassGroupId', 'int', CreoleTypes::INTEGER, 'class_group', 'ID', false, null); $tMap->addForeignKey('TEST_APPLICANT_ID', 'TestApplicantId', 'int', CreoleTypes::INTEGER, 'test_applicant', 'ID', false, null); $tMap->addForeignKey('STUDENT_DETAIL_ID', 'StudentDetailId', 'int', CreoleTypes::INTEGER, 'student_detail', 'ID', false, null); $tMap->addForeignKey('MEMBER_ID', 'MemberId', 'int', CreoleTypes::INTEGER, 'member', 'ID', false, null); $tMap->addColumn('STATUS', 'Status', 'string', CreoleTypes::CHAR, false, null); $tMap->addColumn('GRADUATION_DATE', 'GraduationDate', 'int', CreoleTypes::DATE, false, null); $tMap->addColumn('PASSWORD', 'Password', 'string', CreoleTypes::VARCHAR, true, 40); $tMap->addColumn('CLASS_NAME', 'ClassName', 'string', CreoleTypes::VARCHAR, false, 2); $tMap->addColumn('YEAR', 'Year', 'string', CreoleTypes::VARCHAR, false, 4); $tMap->addColumn('DATE_IN', 'DateIn', 'int', CreoleTypes::DATE, false, null); $tMap->addColumn('NIK', 'Nik', 'string', CreoleTypes::VARCHAR, false, 64); }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(UserProfilePeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(UserProfilePeer::TABLE_NAME); $tMap->setPhpName('UserProfile'); $tMap->setClassname('UserProfile'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); $tMap->addForeignKey('USER_ID', 'UserId', 'INTEGER', 'sf_guard_user', 'ID', true, null); $tMap->addColumn('LANGUAGE', 'Language', 'VARCHAR', false, 5); $tMap->addColumn('NOMBRE', 'Nombre', 'VARCHAR', false, 255); $tMap->addColumn('APELLIDO', 'Apellido', 'VARCHAR', false, 255); $tMap->addColumn('FDN', 'Fdn', 'DATE', false, null); $tMap->addForeignKey('NACIONALIDAD', 'Nacionalidad', 'INTEGER', 'geo_pais', 'ID', false, null); $tMap->addColumn('DOCUMENTO_TIPO', 'DocumentoTipo', 'TINYINT', false, null); $tMap->addColumn('DOCUMENTO_NUMERO', 'DocumentoNumero', 'VARCHAR', false, 15); $tMap->addColumn('CUIL', 'Cuil', 'VARCHAR', false, 13); $tMap->addColumn('LEGAJO', 'Legajo', 'VARCHAR', false, 5); $tMap->addColumn('TELEFONO', 'Telefono', 'VARCHAR', false, 255); $tMap->addColumn('MOVIL', 'Movil', 'VARCHAR', false, 255); $tMap->addColumn('EMAIL', 'Email', 'VARCHAR', false, 255); $tMap->addColumn('DOMICILIO_CALLE', 'DomicilioCalle', 'VARCHAR', false, 50); $tMap->addColumn('DOMICILIO_NUMERO', 'DomicilioNumero', 'VARCHAR', false, 5); $tMap->addColumn('DOMICILIO_MANZANA', 'DomicilioManzana', 'VARCHAR', false, 5); $tMap->addColumn('DOMICILIO_BARRIO', 'DomicilioBarrio', 'VARCHAR', false, 50); $tMap->addColumn('DOMICILIO_PISO', 'DomicilioPiso', 'VARCHAR', false, 2); $tMap->addColumn('DOMICILIO_DEPTO', 'DomicilioDepto', 'VARCHAR', false, 2); $tMap->addForeignKey('LOCALIDAD_ID', 'LocalidadId', 'INTEGER', 'geo_localidad', 'ID', false, null); $tMap->addForeignKey('PROVINCIA_ID', 'ProvinciaId', 'INTEGER', 'geo_provincia', 'ID', false, null); $tMap->addColumn('COMENTARIO', 'Comentario', 'LONGVARCHAR', false, null); }
public static function abortDbBatchJob(BatchJob $dbBatchJob, $force = false) { // No need to abort finished job if (in_array($dbBatchJob->getStatus(), BatchJobPeer::getClosedStatusList())) { if ($force) { $dbBatchJob->setExecutionStatus(BatchJobExecutionStatus::ABORTED); $dbBatchJob->save(); } return $dbBatchJob; } $lockObject = $dbBatchJob->getBatchJobLock(); if (is_null($lockObject)) { KalturaLog::err("Batch job [" . $dbBatchJob->getId() . "] doesn't have a lock object and can't be deleted. Status (" . $dbBatchJob->getStatus() . ")"); return $dbBatchJob; } // Update status $con = Propel::getConnection(); $update = new Criteria(); $update->add(BatchJobLockPeer::STATUS, BatchJob::BATCHJOB_STATUS_ABORTED); $update->add(BatchJobLockPeer::VERSION, $lockObject->getVersion() + 1); $updateCondition = new Criteria(); $updateCondition->add(BatchJobLockPeer::ID, $lockObject->getId(), Criteria::EQUAL); $updateCondition->add(BatchJobLockPeer::VERSION, $lockObject->getVersion(), Criteria::EQUAL); $updateCondition->add(BatchJobLockPeer::SCHEDULER_ID, null, Criteria::ISNULL); $affectedRows = BasePeer::doUpdate($updateCondition, $update, $con); if ($affectedRows) { $dbBatchJob->setExecutionStatus(BatchJobExecutionStatus::ABORTED); $dbBatchJob = self::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_ABORTED); } else { $dbBatchJob->setExecutionStatus(BatchJobExecutionStatus::ABORTED); $dbBatchJob->save(); } self::abortChildJobs($dbBatchJob); return $dbBatchJob; }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(ParametroPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(ParametroPeer::TABLE_NAME); $tMap->setPhpName('Parametro'); $tMap->setClassname('Parametro'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID_PARAMETRO', 'IdParametro', 'INTEGER', true, null); $tMap->addForeignKey('TIPOPARAMETRO', 'Tipoparametro', 'VARCHAR', 'parametro_def', 'TIPOPARAMETRO', true, 100); $tMap->addColumn('NOMBRE', 'Nombre', 'VARCHAR', false, 100); $tMap->addColumn('ORDEN', 'Orden', 'INTEGER', false, null); $tMap->addColumn('NUMERO', 'Numero', 'FLOAT', false, null); $tMap->addColumn('NUMERO2', 'Numero2', 'FLOAT', false, null); $tMap->addColumn('CADENA', 'Cadena', 'LONGVARCHAR', false, null); $tMap->addColumn('CADENA1', 'Cadena1', 'LONGVARCHAR', false, null); $tMap->addColumn('OTROOBJETO', 'Otroobjeto', 'INTEGER', false, null); $tMap->addColumn('SI_NO', 'SiNo', 'BOOLEAN', false, null); $tMap->addColumn('FECHA', 'Fecha', 'TIMESTAMP', false, null); $tMap->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null); $tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null); $tMap->addColumn('FECHABORRADO', 'Fechaborrado', 'TIMESTAMP', false, null); $tMap->addColumn('NOMBREFICHERO', 'Nombrefichero', 'VARCHAR', false, 200); $tMap->addColumn('TIPO', 'Tipo', 'VARCHAR', false, 100); $tMap->addColumn('FICHERO', 'Fichero', 'LONGVARCHAR', false, null); $tMap->addColumn('TAMANO', 'Tamano', 'INTEGER', false, null); }
public function doBuild() { $this->dbMap = Propel::getDatabaseMap('propel'); $tMap = $this->dbMap->addTable('v_spp'); $tMap->setPhpName('VSpp'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); $tMap->addForeignKey('STUDENT_ID', 'StudentId', 'int', CreoleTypes::INTEGER, 'student', 'ID', false, null); $tMap->addForeignKey('ACADEMIC_COST_ID', 'AcademicCostId', 'int', CreoleTypes::INTEGER, 'academic_cost', 'ID', false, null); $tMap->addForeignKey('USER_ID', 'UserId', 'int', CreoleTypes::INTEGER, 'user', 'ID', false, null); $tMap->addColumn('AMOUNT', 'Amount', 'double', CreoleTypes::FLOAT, false, null); $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addForeignKey('ACADEMIC_PROCESS_ID', 'AcademicProcessId', 'int', CreoleTypes::INTEGER, 'academic_process', 'ID', false, null); $tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('PAYER_TYPE', 'PayerType', 'string', CreoleTypes::CHAR, false, 1); $tMap->addColumn('RECEIVABLE', 'Receivable', 'double', CreoleTypes::FLOAT, false, null); $tMap->addColumn('PAID', 'Paid', 'double', CreoleTypes::FLOAT, false, null); $tMap->addColumn('STATUS', 'Status', 'string', CreoleTypes::CHAR, false, 1); $tMap->addColumn('COMMENTS', 'Comments', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('PAYMENT_MODEL_ID', 'PaymentModelId', 'int', CreoleTypes::INTEGER, 'payment_model', 'ID', false, null); $tMap->addForeignKey('TRANSACTION_STATUS_ID', 'TransactionStatusId', 'int', CreoleTypes::INTEGER, 'transaction_status', 'ID', false, null); $tMap->addColumn('PAID_AT', 'PaidAt', 'int', CreoleTypes::DATE, false, null); $tMap->addColumn('YEAR', 'Year', 'double', CreoleTypes::NUMERIC, false, 4); $tMap->addColumn('MONTH', 'Month', 'string', CreoleTypes::CHAR, false, 1); $tMap->addForeignKey('ACADEMIC_COST_COMPONENT_ID', 'AcademicCostComponentId', 'int', CreoleTypes::INTEGER, 'academic_cost_component', 'ID', false, null); $tMap->addForeignKey('ACADEMIC_CALENDAR_ID', 'AcademicCalendarId', 'int', CreoleTypes::INTEGER, 'academic_calendar', 'ID', false, null); }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(JobeetJobPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(JobeetJobPeer::TABLE_NAME); $tMap->setPhpName('JobeetJob'); $tMap->setClassname('JobeetJob'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); $tMap->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'jobeet_category', 'ID', true, null); $tMap->addColumn('TYPE', 'Type', 'VARCHAR', false, 255); $tMap->addColumn('COMPANY', 'Company', 'VARCHAR', true, 255); $tMap->addColumn('LOGO', 'Logo', 'VARCHAR', false, 255); $tMap->addColumn('URL', 'Url', 'VARCHAR', false, 255); $tMap->addColumn('POSITION', 'Position', 'VARCHAR', true, 255); $tMap->addColumn('LOCATION', 'Location', 'VARCHAR', true, 255); $tMap->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', true, null); $tMap->addColumn('HOW_TO_APPLY', 'HowToApply', 'LONGVARCHAR', true, null); $tMap->addColumn('TOKEN', 'Token', 'VARCHAR', true, 255); $tMap->addColumn('IS_PUBLIC', 'IsPublic', 'BOOLEAN', true, null); $tMap->addColumn('IS_ACTIVATED', 'IsActivated', 'BOOLEAN', true, null); $tMap->addColumn('EMAIL', 'Email', 'VARCHAR', true, 255); $tMap->addColumn('EXPIRES_AT', 'ExpiresAt', 'TIMESTAMP', true, null); $tMap->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null); $tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null); }
public function save($con = null) { $con = Propel::getConnection(); try { $con->begin(); $ret = parent::save($con); // update vocabulary_has_user table $userId = sfContext::getInstance()->getUser()->getSubscriberId(); $vocabularyId = $this->getId(); $mode = sfContext::getInstance()->getRequest()->getParameter('action'); if ($userId && $vocabularyId) { //see if there's already an entry in the table and if not, add it $criteria = new Criteria(); $criteria->add(VocabularyHasUserPeer::USER_ID, $userId); $VocabularyHasUsersColl = $this->getVocabularyHasUsers($criteria, $con); if (!count($VocabularyHasUsersColl)) { $vocabularyUser = new VocabularyHasUser(); $vocabularyUser->setVocabularyId($vocabularyId); $vocabularyUser->setUserId($userId); $vocabularyUser->setIsRegistrarFor(true); $vocabularyUser->setIsAdminFor(true); $vocabularyUser->setIsMaintainerFor(true); $vocabularyUser->save($con); } } $con->commit(); return $ret; } catch (Exception $e) { $con->rollback(); throw $e; } }
public function loadFixtures($fixtures) { // initialize database manager $databaseManager = new sfDatabaseManager($this); // cleanup database $db = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . '/database.sqlite'; if (file_exists($db)) { unlink($db); } // initialize database $sql = file_get_contents(sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'lib.model.schema.sql'); $sql = preg_replace('/^\\s*\\-\\-.+$/m', '', $sql); $sql = preg_replace('/^\\s*DROP TABLE .+?$/m', '', $sql); $con = Propel::getConnection(); $tables = preg_split('/CREATE TABLE/', $sql); foreach ($tables as $table) { $table = trim($table); if (!$table) { continue; } $con->executeQuery('CREATE TABLE ' . $table); } // load fixtures $data = new sfPropelData(); if (is_array($fixtures)) { $data->loadDataFromArray($fixtures); } else { $data->loadData(sfConfig::get('sf_data_dir') . '/' . $fixtures); } }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(PatientPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(PatientPeer::TABLE_NAME); $tMap->setPhpName('Patient'); $tMap->setClassname('Patient'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, 11); $tMap->addColumn('ID_NUMBER', 'IdNumber', 'VARCHAR', false, 20); $tMap->addColumn('CNIC', 'Cnic', 'VARCHAR', false, 25); $tMap->addColumn('USERNAME', 'Username', 'VARCHAR', false, 50); $tMap->addColumn('PASSWORD', 'Password', 'VARCHAR', false, 50); $tMap->addColumn('NAME', 'Name', 'VARCHAR', false, 100); $tMap->addColumn('FATHER_NAME', 'FatherName', 'VARCHAR', false, 50); $tMap->addColumn('DOB', 'Dob', 'DATE', false, null); $tMap->addColumn('GENDER', 'Gender', 'VARCHAR', false, 10); $tMap->addColumn('ADDRESS', 'Address', 'VARCHAR', false, 255); $tMap->addColumn('CONTACT_RES', 'ContactRes', 'VARCHAR', false, 20); $tMap->addColumn('CONTACT_CELL', 'ContactCell', 'VARCHAR', false, 20); $tMap->addColumn('EMERGENCY_CONTACT', 'EmergencyContact', 'VARCHAR', false, 20); $tMap->addColumn('EMAIL', 'Email', 'VARCHAR', false, 100); $tMap->addColumn('BLOOD_GROUP', 'BloodGroup', 'VARCHAR', false, 5); $tMap->addColumn('DISEASE', 'Disease', 'VARCHAR', false, 255); $tMap->addColumn('ALLERGY', 'Allergy', 'VARCHAR', false, 255); $tMap->addColumn('DRUG_ALLERGY', 'DrugAllergy', 'VARCHAR', false, 255); $tMap->addColumn('STATUS', 'Status', 'VARCHAR', false, 10); $tMap->addColumn('CREATED_AT', 'CreatedAt', 'DATE', false, null); $tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'DATE', false, null); }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(ItineraryBackupPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(ItineraryBackupPeer::TABLE_NAME); $tMap->setPhpName('ItineraryBackup'); $tMap->setClassname('ItineraryBackup'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, 11); $tMap->addColumn('DATE_REQUESTED', 'DateRequested', 'TIMESTAMP', true, null); $tMap->addColumn('MISSION_REQUEST_ID', 'MissionRequestId', 'INTEGER', false, 11); $tMap->addColumn('MISSION_TYPE_ID', 'MissionTypeId', 'INTEGER', false, 11); $tMap->addColumn('APOINT_TIME', 'ApointTime', 'VARCHAR', true, 50); $tMap->addColumn('PASSENGER_ID', 'PassengerId', 'INTEGER', true, 11); $tMap->addColumn('REQUESTER_ID', 'RequesterId', 'INTEGER', false, 11); $tMap->addColumn('FACILITY', 'Facility', 'VARCHAR', false, 50); $tMap->addColumn('LODGING', 'Lodging', 'VARCHAR', false, 50); $tMap->addColumn('ORGIN_CITY', 'OrginCity', 'VARCHAR', false, 50); $tMap->addColumn('ORGIN_STATE', 'OrginState', 'VARCHAR', false, 2); $tMap->addColumn('DEST_CITY', 'DestCity', 'VARCHAR', false, 50); $tMap->addColumn('DEST_STATE', 'DestState', 'VARCHAR', false, 2); $tMap->addColumn('WAIVER_NEED', 'WaiverNeed', 'TINYINT', false, 4); $tMap->addColumn('NEED_MEDICAL_RELEASE', 'NeedMedicalRelease', 'TINYINT', false, 4); $tMap->addColumn('COMMENT', 'Comment', 'VARCHAR', false, 255); $tMap->addColumn('AGENCY_ID', 'AgencyId', 'INTEGER', true, 11); $tMap->addColumn('CAMP_ID', 'CampId', 'INTEGER', false, 11); $tMap->addColumn('LEG_ID', 'LegId', 'INTEGER', false, 11); $tMap->addColumn('POINT_TIME', 'PointTime', 'TIME', false, null); }
/** * Update the application delay registry * @param array $aData * @return string **/ public function update($aData) { $oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME); try { $oAppDelay = AppDelayPeer::retrieveByPK($aData['APP_DELAY_UID']); if (!is_null($oAppDelay)) { $oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME); if ($oAppDelay->validate()) { $oConnection->begin(); $iResult = $oAppDelay->save(); $oConnection->commit(); return $iResult; } else { $sMessage = ''; $aValidationFailures = $oAppDelay->getValidationFailures(); foreach ($aValidationFailures as $oValidationFailure) { $sMessage .= $oValidationFailure->getMessage() . '<br />'; } throw new Exception('The registry cannot be updated!<br />' . $sMessage); } } else { throw new Exception('This row doesn\'t exist!'); } } catch (Exception $oError) { $oConnection->rollback(); throw $oError; } }
public static function doUpdateAllModerations($selectCriteria, $values, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } return BasePeer::doUpdate($selectCriteria, $values, $con); }
/** * update the current dataset with new values from the database * if posible only with values since our lastUpdated moment */ public function updateDataset() { if ($this->updated) { return; } $limit = 20000; $end = null; $start = $this->lastUpdated; $con = \Propel::getConnection(); $table = $this->type == self::TYPE_SELL_LISTING ? 'sell_listing' : 'buy_listing'; $and = ""; // only retrieve new ticks since last update if ($start) { $and = " AND listing_datetime > '{$start->format('Y-m-d H:i:s')}'"; } $stmt = $con->prepare("\n SELECT\n listing_datetime AS listingDatetime,\n MIN(unit_price) AS min_unit_price\n FROM {$table}\n WHERE item_id = {$this->itemId}\n {$and}\n GROUP BY listing_datetime\n ORDER BY listing_datetime ASC\n LIMIT {$limit}"); $stmt->execute(); $listings = $stmt->fetchAll(\PDO::FETCH_ASSOC); foreach ($listings as $listing) { $date = new DateTime("{$listing['listingDatetime']}"); $rate = intval($listing['min_unit_price']); $end = $date; $this->processTick($date, $rate); } if (!($this->uptodate = count($listings) != $limit)) { $app = Application::getInstance(); $app['no_cache'] = true; } // update for next time $this->updated = true; if ($end) { $this->lastUpdated = $end; } }
public function save($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (is_null($con)) { $con = Propel::getConnection(); } try { $con->beginTransaction(); $values = $this->getValues(); $school_year = SchoolYearPeer::retrieveByPK($values["school_year_id"]); $shift = ShiftPeer::retrieveByPK($values["shift_id"]); unset($values["school_year_id"]); unset($values["shift_id"]); foreach ($values as $student_id) { $student = StudentPeer::retrieveByPk($student_id); if (!$student->getIsRegistered($school_year)) { $student->registerToSchoolYear($school_year, $shift, $con); } } $con->commit(); } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(ActivitatsPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(ActivitatsPeer::TABLE_NAME); $tMap->setPhpName('Activitats'); $tMap->setClassname('Activitats'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ACTIVITATID', 'Activitatid', 'INTEGER', true, 11); $tMap->addForeignKey('CICLES_CICLEID', 'CiclesCicleid', 'INTEGER', 'cicles', 'CICLEID', false, 11); $tMap->addForeignKey('TIPUSACTIVITAT_IDTIPUSACTIVITAT', 'TipusactivitatIdtipusactivitat', 'INTEGER', 'tipusactivitat', 'IDTIPUSACTIVITAT', false, 11); $tMap->addColumn('NOM', 'Nom', 'LONGVARCHAR', false, null); $tMap->addColumn('PREU', 'Preu', 'DOUBLE', false, null); $tMap->addColumn('PREUREDUIT', 'Preureduit', 'DOUBLE', false, null); $tMap->addColumn('PUBLICABLE', 'Publicable', 'TINYINT', false, 4); $tMap->addColumn('ESTAT', 'Estat', 'CHAR', false, 1); $tMap->addColumn('DESCRIPCIO', 'Descripcio', 'LONGVARCHAR', true, null); $tMap->addColumn('IMATGE', 'Imatge', 'LONGVARCHAR', true, null); $tMap->addColumn('PDF', 'Pdf', 'LONGVARCHAR', true, null); $tMap->addColumn('PUBLICAWEB', 'Publicaweb', 'TINYINT', true, 1); $tMap->addColumn('TCURT', 'Tcurt', 'LONGVARCHAR', true, null); $tMap->addColumn('DCURT', 'Dcurt', 'LONGVARCHAR', true, null); $tMap->addColumn('TMIG', 'Tmig', 'LONGVARCHAR', true, null); $tMap->addColumn('DMIG', 'Dmig', 'LONGVARCHAR', true, null); $tMap->addColumn('TCOMPLET', 'Tcomplet', 'LONGVARCHAR', true, null); $tMap->addColumn('DCOMPLET', 'Dcomplet', 'LONGVARCHAR', true, null); $tMap->addColumn('TIPUSENVIAMENT', 'Tipusenviament', 'TINYINT', true, 4); $tMap->addColumn('ORGANITZADOR', 'Organitzador', 'VARCHAR', true, 250); $tMap->addColumn('CATEGORIES', 'Categories', 'VARCHAR', true, 100); }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(ReservaespaisPeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(ReservaespaisPeer::TABLE_NAME); $tMap->setPhpName('Reservaespais'); $tMap->setClassname('Reservaespais'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('RESERVAESPAIID', 'Reservaespaiid', 'INTEGER', true, 11); $tMap->addColumn('REPRESENTACIO', 'Representacio', 'LONGVARCHAR', false, null); $tMap->addColumn('RESPONSABLE', 'Responsable', 'LONGVARCHAR', false, null); $tMap->addColumn('PERSONALAUTORITZAT', 'Personalautoritzat', 'LONGVARCHAR', false, null); $tMap->addColumn('PREVISIOASSISTENTS', 'Previsioassistents', 'INTEGER', false, 11); $tMap->addColumn('ESCICLE', 'Escicle', 'TINYINT', false, 1); $tMap->addColumn('EXEMPCIO', 'Exempcio', 'TINYINT', false, 1); $tMap->addColumn('PRESSUPOST', 'Pressupost', 'TINYINT', false, 1); $tMap->addColumn('COLABORACIOCCG', 'Colaboracioccg', 'TINYINT', false, 1); $tMap->addColumn('COMENTARIS', 'Comentaris', 'LONGVARCHAR', false, null); $tMap->addColumn('ESTAT', 'Estat', 'CHAR', false, 1); $tMap->addForeignKey('USUARIS_USUARIID', 'UsuarisUsuariid', 'INTEGER', 'usuaris', 'USUARIID', false, 11); $tMap->addColumn('ORGANITZADORS', 'Organitzadors', 'LONGVARCHAR', true, null); $tMap->addColumn('DATAACTIVITAT', 'Dataactivitat', 'LONGVARCHAR', true, null); $tMap->addColumn('HORARIACTIVITAT', 'Horariactivitat', 'LONGVARCHAR', true, null); $tMap->addColumn('TIPUSACTE', 'Tipusacte', 'LONGVARCHAR', true, null); $tMap->addColumn('NOM', 'Nom', 'LONGVARCHAR', true, null); $tMap->addColumn('ISENREGISTRABLE', 'Isenregistrable', 'TINYINT', true, 1); $tMap->addColumn('ESPAISSOLICITATS', 'Espaissolicitats', 'LONGVARCHAR', true, null); $tMap->addColumn('MATERIALSOLICITAT', 'Materialsolicitat', 'LONGVARCHAR', true, null); $tMap->addColumn('DATAALTA', 'Dataalta', 'TIMESTAMP', false, null); $tMap->addColumn('COMPROMIS', 'Compromis', 'LONGVARCHAR', true, null); $tMap->addColumn('CODI', 'Codi', 'VARCHAR', true, 10); }
/** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap('propel'); $tMap = $this->dbMap->addTable('reg_schema'); $tMap->setPhpName('Schema'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); $tMap->addForeignKey('AGENT_ID', 'AgentId', 'int', CreoleTypes::INTEGER, 'reg_agent', 'ID', true, null); $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('DELETED_AT', 'DeletedAt', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addForeignKey('CREATED_USER_ID', 'CreatedUserId', 'int', CreoleTypes::INTEGER, 'reg_user', 'ID', false, null); $tMap->addForeignKey('UPDATED_USER_ID', 'UpdatedUserId', 'int', CreoleTypes::INTEGER, 'reg_user', 'ID', false, null); $tMap->addColumn('CHILD_UPDATED_AT', 'ChildUpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addColumn('CHILD_UPDATED_USER_ID', 'ChildUpdatedUserId', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('NOTE', 'Note', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('URI', 'Uri', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('URL', 'Url', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addColumn('BASE_DOMAIN', 'BaseDomain', 'string', CreoleTypes::VARCHAR, true, 255); $tMap->addColumn('TOKEN', 'Token', 'string', CreoleTypes::VARCHAR, true, 45); $tMap->addColumn('COMMUNITY', 'Community', 'string', CreoleTypes::VARCHAR, false, 45); $tMap->addColumn('LAST_URI_ID', 'LastUriId', 'int', CreoleTypes::INTEGER, false, null); $tMap->addForeignKey('STATUS_ID', 'StatusId', 'int', CreoleTypes::INTEGER, 'reg_status', 'ID', true, null); $tMap->addColumn('LANGUAGE', 'Language', 'string', CreoleTypes::CHAR, true, 6); $tMap->addForeignKey('PROFILE_ID', 'ProfileId', 'int', CreoleTypes::INTEGER, 'profile', 'ID', false, null); $tMap->addColumn('NS_TYPE', 'NsType', 'string', CreoleTypes::CHAR, true, 6); $tMap->addColumn('PREFIXES', 'Prefixes', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('LANGUAGES', 'Languages', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('REPO', 'Repo', 'string', CreoleTypes::VARCHAR, true, 255); }
public function executeCreate_tree(sfWebRequest $request) { $request->setRequestFormat('json'); $title = $request->getParameter('item_title'); $user = $this->getUser()->getAttribute('s_current_user', null); if ($user != null) { try { $conn = Propel::getConnection(); $conn->beginTransaction(); $tree_bean = new TreeSc(); $tree_bean->setName($title); $tree_bean->setUserId($user->getId()); $tree_bean->setConfigureFlag(''); $tree_bean->setConfigureDesign(''); $tree_bean->setFlag(1); $tree_bean->save(); $tree_user_bean = new TreeUser(); $tree_user_bean->setUserId($tree_bean->getUserId()); $tree_user_bean->setTreeId($tree_bean->getId()); $tree_user_bean->save(); $conn->commit(); $this->message = 'success'; $this->treepk = $tree_bean->getId(); $this->title = $tree_bean->getName(); return sfView::SUCCESS; } catch (Exception $e) { $this->message = $e->getMessage(); return sfView::ERROR; } } else { $this->message = 'session expired'; return sfView::ERROR; } }
public function doBuild() { $this->dbMap = Propel::getDatabaseMap('propel'); $tMap = $this->dbMap->addTable('v_applicant_test'); $tMap->setPhpName('VApplicantTest'); $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); $tMap->addForeignKey('TEST_APPLICANT_DETAIL_ID', 'TestApplicantDetailId', 'int', CreoleTypes::INTEGER, 'test_applicant_detail', 'ID', false, null); $tMap->addColumn('CODE', 'Code', 'string', CreoleTypes::VARCHAR, false, 64); $tMap->addColumn('CODE2', 'Code2', 'string', CreoleTypes::VARCHAR, false, 64); $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, false, 255); $tMap->addForeignKey('DEPARTMENT_ID', 'DepartmentId', 'int', CreoleTypes::INTEGER, 'department', 'ID', false, null); $tMap->addForeignKey('CLASS_GROUP_ID', 'ClassGroupId', 'int', CreoleTypes::INTEGER, 'class_group', 'ID', false, null); $tMap->addForeignKey('REG_TEST_PERIOD_ID', 'RegTestPeriodId', 'int', CreoleTypes::INTEGER, 'reg_test_period', 'ID', false, null); $tMap->addForeignKey('LOCATION_ID', 'LocationId', 'int', CreoleTypes::INTEGER, 'location', 'ID', false, null); $tMap->addForeignKey('CLASS_ID', 'ClassId', 'int', CreoleTypes::INTEGER, 'class_group', 'ID', false, null); $tMap->addColumn('ISPASS1', 'Ispass1', 'int', CreoleTypes::INTEGER, false, 1); $tMap->addColumn('RANK1', 'Rank1', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('APPLICANT_TYPE', 'ApplicantType', 'string', CreoleTypes::CHAR, false, 1); $tMap->addColumn('ENROLLED', 'Enrolled', 'boolean', CreoleTypes::BOOLEAN, false, null); $tMap->addColumn('REG_INFO', 'RegInfo', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('STATUS', 'Status', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('IS_ALAZHAR', 'IsAlazhar', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('HEREG_STATUS', 'HeregStatus', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('YEAR', 'Year', 'string', CreoleTypes::VARCHAR, false, 4); $tMap->addColumn('PASSWORD', 'Password', 'string', CreoleTypes::VARCHAR, true, 40); }