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


PHP Publisher::save方法代码示例

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


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

示例1: test_model_cache_new

 public function test_model_cache_new()
 {
     $publisher = new Publisher(array("name" => "HarperCollins"));
     $publisher->save();
     $method = $this->set_method_public('Publisher', 'cache_key');
     $cache_key = $method->invokeArgs($publisher, array());
     $publisherDirectlyFromCache = Cache::$adapter->read($cache_key);
     $this->assertTrue(is_object($publisherDirectlyFromCache));
     $this->assertEquals($publisher->name, $publisherDirectlyFromCache->name);
 }
开发者ID:nehulyadav,项目名称:php-activerecord,代码行数:10,代码来源:CacheModelTest.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Publisher();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Publisher'])) {
         $model->attributes = $_POST['Publisher'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:vlad-doroshchuk,项目名称:testwork1,代码行数:17,代码来源:PublisherController.php

示例3: action

 private function action($form)
 {
     $session = session_currentSession();
     $p = new Publisher();
     $p->user = $session->id;
     $p->label = $form->name;
     $p->short_label = $form->shortname;
     $p->key = $this->generateKey();
     $p->secret = $this->generateSecret();
     $p->domain = $form->domain;
     // ISO-8601 2005-08-14T16:13:03+0000;
     $time = time() + $value;
     $p->created = date('c', $time);
     $p->save();
     header('location:/account/settings');
 }
开发者ID:aventurella,项目名称:Galaxy,代码行数:16,代码来源:ApplicationCreate.php

示例4: actionEdit

 /**
  * Edit a publisher.
  */
 public function actionEdit($id = 0)
 {
     if ($id > 0) {
         $model = Publisher::model()->findByPk($id);
     } else {
         $model = new Publisher();
     }
     if (isset($_POST['Publisher'])) {
         $model->attributes = $_POST['Publisher'];
         if ($model->validate() && $model->save()) {
             Yii::app()->user->setFlash('successmsg', 'The changes have been saved.');
             $this->redirect('/publisher/index');
         } else {
             Yii::app()->user->setFlash('errormsg', 'Error saving the publisher page.');
             $this->render('edit', array('model' => $model, 'id' => $id));
         }
     } else {
         $this->render('edit', array('model' => $model, 'id' => $id));
     }
 }
开发者ID:sundgaarden,项目名称:dashboard,代码行数:23,代码来源:PublisherController.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Publisher();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Publisher'])) {
         $model->attributes = $_POST['Publisher'];
         if ($model->validate()) {
             if ($model->save()) {
                 Yii::app()->clientScript->scriptMap['jquery.js'] = false;
                 echo CJSON::encode(array('status' => 'success', 'div' => "<div class=alert alert-info fade in>Successfully added ! </div>"));
                 Yii::app()->end();
             }
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $cs = Yii::app()->clientScript;
         $cs->scriptMap = array('jquery.js' => false, 'bootstrap.js' => false, 'jquery.min.js' => false, 'bootstrap.notify.js' => false, 'bootstrap.bootbox.min.js' => false);
         echo CJSON::encode(array('status' => 'render', 'div' => $this->renderPartial('_form', array('model' => $model), true, false)));
         Yii::app()->end();
     } else {
         $this->render('create', array('model' => $model));
     }
 }
开发者ID:noonnightcoder,项目名称:bakou-pos-apsara,代码行数:28,代码来源:PublisherController.php

示例6: Publisher

    $scholastic->setName("Scholastic");
    // do not save, will do later to test cascade
    print "Added publisher \"Scholastic\" [not saved yet].\n";
    $morrow = new Publisher();
    $morrow->setName("William Morrow");
    $morrow->save();
    $morrow_id = $morrow->getId();
    print "Added publisher \"William Morrow\" [id = {$morrow_id}].\n";
    $penguin = new Publisher();
    $penguin->setName("Penguin");
    $penguin->save();
    $penguin_id = $penguin->getId();
    print "Added publisher \"Penguin\" [id = {$penguin_id}].\n";
    $vintage = new Publisher();
    $vintage->setName("Vintage");
    $vintage->save();
    $vintage_id = $vintage->getId();
    print "Added publisher \"Vintage\" [id = {$vintage_id}].\n";
} catch (Exception $e) {
    die("Error adding publisher: " . $e->__toString());
}
// Add author records
// ------------------
try {
    print "\nAdding some new authors to the list\n";
    print "--------------------------------------\n\n";
    $rowling = new Author();
    $rowling->setFirstName("J.K.");
    $rowling->setLastName("Rowling");
    // no save()
    print "Added author \"J.K. Rowling\" [not saved yet].\n";
开发者ID:yasirgit,项目名称:afids,代码行数:31,代码来源:bookstore-test.php

示例7: testSpeed

 public function testSpeed()
 {
     // Add publisher records
     // ---------------------
     $scholastic = new Publisher();
     $scholastic->setName("Scholastic");
     // do not save, will do later to test cascade
     $morrow = new Publisher();
     $morrow->setName("William Morrow");
     $morrow->save();
     $morrow_id = $morrow->getId();
     $penguin = new Publisher();
     $penguin->setName("Penguin");
     $penguin->save();
     $penguin_id = $penguin->getId();
     $vintage = new Publisher();
     $vintage->setName("Vintage");
     $vintage->save();
     $vintage_id = $vintage->getId();
     // Add author records
     // ------------------
     $rowling = new Author();
     $rowling->setFirstName("J.K.");
     $rowling->setLastName("Rowling");
     // no save()
     $stephenson = new Author();
     $stephenson->setFirstName("Neal");
     $stephenson->setLastName("Stephenson");
     $stephenson->save();
     $stephenson_id = $stephenson->getId();
     $byron = new Author();
     $byron->setFirstName("George");
     $byron->setLastName("Byron");
     $byron->save();
     $byron_id = $byron->getId();
     $grass = new Author();
     $grass->setFirstName("Gunter");
     $grass->setLastName("Grass");
     $grass->save();
     $grass_id = $grass->getId();
     // Add book records
     // ----------------
     $phoenix = new Book();
     $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
     $phoenix->setISBN("043935806X");
     // cascading save (Harry Potter)
     $phoenix->setAuthor($rowling);
     $phoenix->setPublisher($scholastic);
     $phoenix->save();
     $phoenix_id = $phoenix->getId();
     $qs = new Book();
     $qs->setISBN("0380977427");
     $qs->setTitle("Quicksilver");
     $qs->setAuthor($stephenson);
     $qs->setPublisher($morrow);
     $qs->save();
     $qs_id = $qs->getId();
     $dj = new Book();
     $dj->setISBN("0140422161");
     $dj->setTitle("Don Juan");
     $dj->setAuthor($byron);
     $dj->setPublisher($penguin);
     $dj->save();
     $dj_id = $qs->getId();
     $td = new Book();
     $td->setISBN("067972575X");
     $td->setTitle("The Tin Drum");
     $td->setAuthor($grass);
     $td->setPublisher($vintage);
     $td->save();
     $td_id = $td->getId();
     // Add review records
     // ------------------
     $r1 = new Review();
     $r1->setBook($phoenix);
     $r1->setReviewedBy("Washington Post");
     $r1->setRecommended(true);
     $r1->setReviewDate(time());
     $r1->save();
     $r1_id = $r1->getId();
     $r2 = new Review();
     $r2->setBook($phoenix);
     $r2->setReviewedBy("New York Times");
     $r2->setRecommended(false);
     $r2->setReviewDate(time());
     $r2->save();
     $r2_id = $r2->getId();
     // Perform a "complex" search
     // --------------------------
     $crit = new Criteria();
     $crit->add(BookPeer::TITLE, 'Harry%', Criteria::LIKE);
     $results = BookPeer::doSelect($crit);
     $crit2 = new Criteria();
     $crit2->add(BookPeer::ISBN, array("0380977427", "0140422161"), Criteria::IN);
     $results = BookPeer::doSelect($crit2);
     // Perform a "limit" search
     // ------------------------
     $crit = new Criteria();
     $crit->setLimit(2);
     $crit->setOffset(1);
//.........这里部分代码省略.........
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:101,代码来源:speed.php

示例8: populate

 public static function populate($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     }
     $con->beginTransaction();
     // Add publisher records
     // ---------------------
     $scholastic = new Publisher();
     $scholastic->setName("Scholastic");
     // do not save, will do later to test cascade
     $morrow = new Publisher();
     $morrow->setName("William Morrow");
     $morrow->save($con);
     $morrow_id = $morrow->getId();
     $penguin = new Publisher();
     $penguin->setName("Penguin");
     $penguin->save();
     $penguin_id = $penguin->getId();
     $vintage = new Publisher();
     $vintage->setName("Vintage");
     $vintage->save($con);
     $vintage_id = $vintage->getId();
     $rowling = new Author();
     $rowling->setFirstName("J.K.");
     $rowling->setLastName("Rowling");
     // no save()
     $stephenson = new Author();
     $stephenson->setFirstName("Neal");
     $stephenson->setLastName("Stephenson");
     $stephenson->save($con);
     $stephenson_id = $stephenson->getId();
     $byron = new Author();
     $byron->setFirstName("George");
     $byron->setLastName("Byron");
     $byron->save($con);
     $byron_id = $byron->getId();
     $grass = new Author();
     $grass->setFirstName("Gunter");
     $grass->setLastName("Grass");
     $grass->save($con);
     $grass_id = $grass->getId();
     $phoenix = new Book();
     $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
     $phoenix->setISBN("043935806X");
     $phoenix->setAuthor($rowling);
     $phoenix->setPublisher($scholastic);
     $phoenix->setPrice(10.99);
     $phoenix->save($con);
     $phoenix_id = $phoenix->getId();
     $qs = new Book();
     $qs->setISBN("0380977427");
     $qs->setTitle("Quicksilver");
     $qs->setPrice(11.99);
     $qs->setAuthor($stephenson);
     $qs->setPublisher($morrow);
     $qs->save($con);
     $qs_id = $qs->getId();
     $dj = new Book();
     $dj->setISBN("0140422161");
     $dj->setTitle("Don Juan");
     $dj->setPrice(12.99);
     $dj->setAuthor($byron);
     $dj->setPublisher($penguin);
     $dj->save($con);
     $dj_id = $dj->getId();
     $td = new Book();
     $td->setISBN("067972575X");
     $td->setTitle("The Tin Drum");
     $td->setPrice(13.99);
     $td->setAuthor($grass);
     $td->setPublisher($vintage);
     $td->save($con);
     $td_id = $td->getId();
     $r1 = new Review();
     $r1->setBook($phoenix);
     $r1->setReviewedBy("Washington Post");
     $r1->setRecommended(true);
     $r1->setReviewDate(time());
     $r1->save($con);
     $r1_id = $r1->getId();
     $r2 = new Review();
     $r2->setBook($phoenix);
     $r2->setReviewedBy("New York Times");
     $r2->setRecommended(false);
     $r2->setReviewDate(time());
     $r2->save($con);
     $r2_id = $r2->getId();
     $blob_path = _LOB_SAMPLE_FILE_PATH . '/tin_drum.gif';
     $clob_path = _LOB_SAMPLE_FILE_PATH . '/tin_drum.txt';
     $m1 = new Media();
     $m1->setBook($td);
     $m1->setCoverImage(file_get_contents($blob_path));
     // CLOB is broken in PDO OCI, see http://pecl.php.net/bugs/bug.php?id=7943
     if (get_class(Propel::getDB()) != "DBOracle") {
         $m1->setExcerpt(file_get_contents($clob_path));
     }
     $m1->save($con);
     // Add book list records
     // ---------------------
//.........这里部分代码省略.........
开发者ID:pkdevbox,项目名称:mootools-forge,代码行数:101,代码来源:BookstoreDataPopulator.php

示例9: testFindOneWithLeftJoinWithOneToManyAndNullObjectsAndWithAdditionalJoins

 public function testFindOneWithLeftJoinWithOneToManyAndNullObjectsAndWithAdditionalJoins()
 {
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     BookOpinionPeer::clearInstancePool();
     BookReaderPeer::clearInstancePool();
     $freud = new Author();
     $freud->setFirstName("Sigmund");
     $freud->setLastName("Freud");
     $freud->save($this->con);
     $publisher = new Publisher();
     $publisher->setName('Psycho Books');
     $publisher->save();
     $book = new Book();
     $book->setAuthor($freud);
     $book->setTitle('Weirdness');
     $book->setIsbn('abc123456');
     $book->setPrice('14.99');
     $book->setPublisher($publisher);
     $book->save();
     $query = BookQuery::create()->filterByTitle('Weirdness')->innerJoinAuthor()->useBookOpinionQuery(null, Criteria::LEFT_JOIN)->leftJoinBookReader()->endUse()->with('Author')->with('BookOpinion')->with('BookReader');
     $books = $query->findOne($this->con);
     $this->assertEquals(0, count($books->getBookOpinions()));
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:24,代码来源:PropelObjectFormatterWithTest.php

示例10: install_submit

 public function install_submit()
 {
     $username = Input::get('username');
     $password = Input::get('password');
     $admin_username = Input::get('admin_username');
     $admin_password = Input::get('admin_password');
     $sitename = Input::get('sitename');
     $database_name = Input::get('database_name');
     $picture = Input::file('picture');
     $timezone = Input::get('timezone');
     $database_host = Input::get('database_host');
     $validator = Validator::make(array('password' => $password, 'username' => $username, 'database_name' => $database_name, 'admin_username' => $admin_username, 'admin_password' => $admin_password, 'sitename' => $sitename, 'picture' => $picture, 'timezone' => $timezone, 'database_host' => $database_host), array('password' => '', 'username' => 'required', 'sitename' => 'required', 'database_name' => 'required', 'admin_password' => 'required', 'admin_username' => 'required', 'timezone' => 'required', 'picture' => 'mimes:png,jpg', 'database_host' => 'required'));
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         return Redirect::back()->with('flash_errors', $error_messages);
     } else {
         $file_name = time();
         $file_name .= rand();
         if (Input::hasFile('picture')) {
             $ext = Input::file('picture')->getClientOriginalExtension();
             Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
             $local_url = $file_name . "." . $ext;
             $s3_url = URL::to('/') . '/uploads/' . $local_url;
         }
         Setting::set('sitename', $sitename);
         Setting::set('footer', "Powered by Appoets");
         Setting::set('username', $username);
         Setting::set('password', $password);
         Setting::set('database_name', $database_name);
         Setting::set('timezone', $timezone);
         Setting::set('logo', $s3_url);
         Setting::set('database_host', $database_host);
         import_db($username, $password, 'localhost', $database_name);
         $admin = new User();
         $admin->email = $admin_username;
         $admin->is_activated = 1;
         $admin->password = Hash::make($admin_password);
         $admin->author_name = "Admin";
         $admin->role_id = 2;
         $admin->save();
         // Default publisher
         $publisher = new Publisher();
         $publisher->name = Input::get('sitename');
         if (Input::hasFile('picture')) {
             $publisher->image = Setting::get('logo');
         }
         $publisher->save();
         // Default category
         $category = new Category();
         $category->name = "Uncategory";
         if (Input::hasFile('picture')) {
             $category->pics = Setting::get('logo');
         }
         $category->save();
         return Redirect::to('/');
     }
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:57,代码来源:HomeController.php

示例11: Publisher

 if ($publisherID == NULL || $publisherName != $holdPublisher) {
     //get the publisher object
     $publisherTestObj = new Publisher();
     $publisherObj = new Publisher();
     $publisherObj = $publisherTestObj->getByName($publisherName);
     if (is_object($publisherObj)) {
         $publisherID = $publisherObj->publisherID;
     }
 }
 //If it does not already exist, insert it and get the new ID
 if ($publisherID == '' && $publisherName) {
     $publisher = new Publisher();
     $publisher->publisherID = '';
     $publisher->name = $publisherName;
     try {
         $publisher->save();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $publisherID = $publisher->primaryKey;
 }
 #################################################################
 // PUBLISHER / PLATFORM
 // Query to see if the Publisher / Platform already exists, if so, get the ID
 #################################################################
 //check it against the previous row - no need to do another lookup if we've already figured out the publisherplatformID
 if (!isset($publisherPlatformID) || $publisherName != $holdPublisher || $platformName != $holdPlatform) {
     //get the publisher platform object
     $publisherPlatformTestObj = new PublisherPlatform();
     $publisherPlatformObj = $publisherPlatformTestObj->getPublisherPlatform($publisherID, $platformID);
     if (is_object($publisherPlatformObj)) {
开发者ID:pontifechs,项目名称:usage,代码行数:31,代码来源:uploadComplete.php

示例12: addPublisher

 public function addPublisher()
 {
     $act = 'add';
     if (Input::has('submit')) {
         $rules = array('publishername' => 'required', 'phone' => 'required', 'email' => 'required|email', 'address' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->passes()) {
             $pb = new Publisher();
             $pb->publishername = Input::get('publishername');
             $pb->phone = Input::get('phone');
             $pb->email = Input::get('email');
             $pb->address = Input::get('address');
             $pb->save();
             return Redirect::to('admin/rkmpublisher')->with('sukses', 'rekam data berhasil!');
         } else {
             return Redirect::to('admin/rkmpublisher')->withInput()->withErrors($validator);
         }
     } else {
         return View::make('admin.publisher', compact('act'));
     }
     //return Redirect::to('admin/publisher')->with('error','illegal operation!!!');
 }
开发者ID:beruxganteng,项目名称:repository-djpbn,代码行数:22,代码来源:BackendController.php

示例13: addPublisherProcess

 public function addPublisherProcess()
 {
     $name = Input::get('name');
     $cat_img = Input::file('cat_img');
     $validator = Validator::make(array('name' => $name, 'cat_img' => $cat_img), array('name' => 'required', 'cat_img' => 'required|mimes:jpeg,bmp,gif,png'));
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         return Redirect::back()->with('flash_errors', $error_messages);
     } else {
         $publisher = new Publisher();
         $publisher->name = Input::get('name');
         $file_name = seo_url(Input::get('name')) . '-' . time();
         $ext = Input::file('cat_img')->getClientOriginalExtension();
         Input::file('cat_img')->move(public_path() . "/uploads", $file_name . "." . $ext);
         $local_url = $file_name . "." . $ext;
         $s3_url = URL::to('/') . '/uploads/' . $local_url;
         $publisher->image = $s3_url;
         $publisher->save();
         if ($publisher) {
             return Redirect::back()->with('flash_success', tr('publisher_add'));
         } else {
             return Redirect::back()->with('flash_error', tr('went_wrong'));
         }
     }
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:25,代码来源:AdminController.php

示例14: savePublisher

 public function savePublisher($publisher_name)
 {
     $publisher_id = null;
     $exists = Publisher::model()->exists('id=:publisher_id', array(':publisher_id' => (int) $publisher_name));
     if (!$exists) {
         $publisher = new Publisher();
         $publisher->name = $publisher_name;
         $publisher->save();
         $publisher_id = $publisher->id;
     }
     return $publisher_id;
 }
开发者ID:noonnightcoder,项目名称:bakou-pos-apsara,代码行数:12,代码来源:Publisher.php

示例15: testObjectInstances_Fkeys

 /**
  *
  */
 public function testObjectInstances_Fkeys()
 {
     // Establish a relationship between one employee and account
     // and then change the employee_id and ensure that the account
     // is not pulling the old employee.
     $pub1 = new Publisher();
     $pub1->setName('Publisher 1');
     $pub1->save();
     $pub2 = new Publisher();
     $pub2->setName('Publisher 2');
     $pub2->save();
     $book = new Book();
     $book->setTitle("Book Title");
     $book->setISBN("1234");
     $book->setPublisher($pub1);
     $book->save();
     $this->assertSame($pub1, $book->getPublisher());
     // now change values behind the scenes
     $con = Propel::getConnection(BookstoreEmployeeAccountPeer::DATABASE_NAME);
     $con->exec("UPDATE " . BookPeer::TABLE_NAME . " SET " . " publisher_id = " . $pub2->getId() . " WHERE id = " . $book->getId());
     $book2 = BookPeer::retrieveByPK($book->getId());
     $this->assertSame($book, $book2, "Expected same book object instance");
     $this->assertEquals($pub1->getId(), $book->getPublisherId(), "Expected book to have OLD publisher id before reload()");
     $book->reload();
     $this->assertEquals($pub2->getId(), $book->getPublisherId(), "Expected book to have new publisher id");
     $this->assertSame($pub2, $book->getPublisher(), "Expected book to have new publisher object associated.");
     // Now let's set it back, just to be double sure ...
     $con->exec("UPDATE " . BookPeer::TABLE_NAME . " SET " . " publisher_id = " . $pub1->getId() . " WHERE id = " . $book->getId());
     $book->reload();
     $this->assertEquals($pub1->getId(), $book->getPublisherId(), "Expected book to have old publisher id (again).");
     $this->assertSame($pub1, $book->getPublisher(), "Expected book to have old publisher object associated (again).");
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:35,代码来源:GeneratedObjectTest.php


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