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


PHP Parser\AbstractParser类代码示例

本文整理汇总了PHP中Propel\Runtime\Parser\AbstractParser的典型用法代码示例。如果您正苦于以下问题:PHP AbstractParser类的具体用法?PHP AbstractParser怎么用?PHP AbstractParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testDump

 public function testDump()
 {
     $testContent = "Foo Content";
     $testFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'propel_test_' . microtime();
     $parser = AbstractParser::getParser('XML');
     $parser->dump($testContent, $testFile);
     $content = file_get_contents($testFile);
     $this->assertEquals($testContent, $content);
     unlink($testFile);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:10,代码来源:AbstractParserTest.php

示例2: exportTo

 /**
  * Export the current object properties to a string, using a given parser format
  * <code>
  * $book = BookQuery::create()->findPk(9012);
  * echo $book->exportTo('JSON');
  *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
  * </code>
  *
  * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
  * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
  * @return string  The exported data
  */
 public function exportTo($parser, $includeLazyLoadColumns = true)
 {
     if (!$parser instanceof AbstractParser) {
         $parser = AbstractParser::getParser($parser);
     }
     return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:19,代码来源:CouponVersion.php

示例3: importFrom

 /**
  * Populate the current object from a string, using a given parser format
  * <code>
  * $book = new Book();
  * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
  * </code>
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
  * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
  * The default key type is the column's TableMap::TYPE_PHPNAME.
  *
  * @param mixed $parser A AbstractParser instance,
  *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
  * @param string $data The source data to import from
  * @param string $keyType The type of keys the array uses.
  *
  * @return $this|\JaCategorias The current object, for fluid interface
  */
 public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
 {
     if (!$parser instanceof AbstractParser) {
         $parser = AbstractParser::getParser($parser);
     }
     $this->fromArray($parser->toArray($data), $keyType);
     return $this;
 }
开发者ID:alejandrososa,项目名称:angularja,代码行数:27,代码来源:JaCategorias.php

示例4: exportTo

 /**
  * Export the current collection to a string, using a given parser format
  * <code>
  * $books = BookQuery::create()->find();
  * echo $book->exportTo('JSON');
  *  => {{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}}');
  * </code>
  *
  * A OnDemandCollection cannot be exported. Any attempt will result in a PropelException being thrown.
  *
  * @param mixed   $parser    A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
  * @param boolean $usePrefix (optional) If true, the returned element keys will be prefixed with the
  *                                            model class name ('Article_0', 'Article_1', etc). Defaults to TRUE.
  *                                            Not supported by ArrayCollection, as ArrayFormatter has
  *                                            already created the array used here with integers as keys.
  * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
  *                                            Not supported by ArrayCollection, as ArrayFormatter has
  *                                            already included lazy-load columns in the array used here.
  * @return string The exported data
  */
 public function exportTo($parser, $usePrefix = true, $includeLazyLoadColumns = true)
 {
     if (!$parser instanceof AbstractParser) {
         $parser = AbstractParser::getParser($parser);
     }
     return $parser->listFromArray($this->toArray(null, $usePrefix, TableMap::TYPE_PHPNAME, $includeLazyLoadColumns));
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:27,代码来源:Collection.php


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