This commit is contained in:
Kévin Gomez 2014-09-15 13:37:23 +01:00
parent 530403636a
commit 23c05811d7
7 changed files with 55 additions and 58 deletions

View file

@ -253,7 +253,7 @@ abstract class AbstractDataLoader extends AbstractDataHandler implements DataLoa
$reflectionClass = new \ReflectionClass($parentClass); $reflectionClass = new \ReflectionClass($parentClass);
if (!$reflectionClass->isAbstract()) { if (!$reflectionClass->isAbstract()) {
$parentObj = new $parentClass; $parentObj = new $parentClass();
$parentObj->fromArray($obj->toArray()); $parentObj->fromArray($obj->toArray());
$this->saveParentReference($parentClass, $key, $parentObj); $this->saveParentReference($parentClass, $key, $parentObj);
} }

View file

@ -61,7 +61,7 @@ class YamlDataLoader extends AbstractDataLoader
} }
ob_start(); ob_start();
$retval = include($file); $retval = include $file;
$content = ob_get_clean(); $content = ob_get_clean();
// if an array is returned by the config file assume it's in plain php form else in YAML // if an array is returned by the config file assume it's in plain php form else in YAML

View file

@ -64,7 +64,7 @@ class PropelParamConverter implements ParamConverterInterface
} }
/** /**
* @param Request $request * @param Request $request
* @param ParamConverter $configuration * @param ParamConverter $configuration
* *
* @return bool * @return bool
@ -122,7 +122,7 @@ class PropelParamConverter implements ParamConverterInterface
unset($this->filters[$configuration->getName()]); unset($this->filters[$configuration->getName()]);
} }
$this->withs = isset($options['with'])? is_array($options['with'])? $options['with'] : array($options['with']) : array(); $this->withs = isset($options['with']) ? is_array($options['with']) ? $options['with'] : array($options['with']) : array();
// find by Pk // find by Pk
if (false === $object = $this->findPk($classQuery, $request)) { if (false === $object = $this->findPk($classQuery, $request)) {

View file

@ -153,7 +153,6 @@ YAML;
$this->assertRegexp('#[\w ]+#', $book->getDescription()); $this->assertRegexp('#[\w ]+#', $book->getDescription());
} }
public function testYamlLoadManyToMany() public function testYamlLoadManyToMany()
{ {
$schema = <<<XML $schema = <<<XML

View file

@ -302,9 +302,9 @@ abstract class Book implements ActiveRecordInterface
* $book->importFrom('JSON', '{"Id":9012,"Name":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); * $book->importFrom('JSON', '{"Id":9012,"Name":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
* </code> * </code>
* *
* @param mixed $parser A AbstractParser instance, * @param mixed $parser A AbstractParser instance,
* or a format name ('XML', 'YAML', 'JSON', 'CSV') * or a format name ('XML', 'YAML', 'JSON', 'CSV')
* @param string $data The source data to import from * @param string $data The source data to import from
* *
* @return Book The current object, for fluid interface * @return Book The current object, for fluid interface
*/ */
@ -541,7 +541,6 @@ abstract class Book implements ActiveRecordInterface
{ {
try { try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : BookTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : BookTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null; $this->id = (null !== $col) ? (int) $col : null;
@ -858,12 +857,12 @@ abstract class Book implements ActiveRecordInterface
/** /**
* Retrieves a field from the object by name passed in as a string. * Retrieves a field from the object by name passed in as a string.
* *
* @param string $name name * @param string $name name
* @param string $type The type of fieldname the $name is of: * @param string $type The type of fieldname the $name is of:
* one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME. * Defaults to TableMap::TYPE_PHPNAME.
* @return mixed Value of field. * @return mixed Value of field.
*/ */
public function getByName($name, $type = TableMap::TYPE_PHPNAME) public function getByName($name, $type = TableMap::TYPE_PHPNAME)
{ {
@ -907,9 +906,9 @@ abstract class Book implements ActiveRecordInterface
* You can specify the key type of the array by passing one of the class * You can specify the key type of the array by passing one of the class
* type constants. * type constants.
* *
* @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME. * Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
@ -946,12 +945,12 @@ abstract class Book implements ActiveRecordInterface
/** /**
* Sets a field from the object by name passed in as a string. * Sets a field from the object by name passed in as a string.
* *
* @param string $name * @param string $name
* @param mixed $value field value * @param mixed $value field value
* @param string $type The type of fieldname the $name is of: * @param string $type The type of fieldname the $name is of:
* one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME. * Defaults to TableMap::TYPE_PHPNAME.
* @return void * @return void
*/ */
public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
@ -1093,7 +1092,7 @@ abstract class Book implements ActiveRecordInterface
$copyObj->setAuthorId($this->getAuthorId()); $copyObj->setAuthorId($this->getAuthorId());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value $copyObj->setId(null); // this is a auto-increment column, so set to default value
} }
} }
@ -1129,7 +1128,7 @@ abstract class Book implements ActiveRecordInterface
public function setAuthor(ChildAuthor $v = null) public function setAuthor(ChildAuthor $v = null)
{ {
if ($v === null) { if ($v === null) {
$this->setAuthorId(NULL); $this->setAuthorId(null);
} else { } else {
$this->setAuthorId($v->getId()); $this->setAuthorId($v->getId());
} }
@ -1145,7 +1144,6 @@ abstract class Book implements ActiveRecordInterface
return $this; return $this;
} }
/** /**
* Get the associated ChildAuthor object * Get the associated ChildAuthor object
* *

View file

@ -232,10 +232,10 @@ abstract class BookQuery extends ModelCriteria
* $query->filterById(array('min' => 12)); // WHERE id > 12 * $query->filterById(array('min' => 12)); // WHERE id > 12
* </code> * </code>
* *
* @param mixed $id The value to use as filter. * @param mixed $id The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildBookQuery The current query, for fluid interface * @return ChildBookQuery The current query, for fluid interface
@ -272,8 +272,8 @@ abstract class BookQuery extends ModelCriteria
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $title The value to use as filter. * @param string $title The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildBookQuery The current query, for fluid interface * @return ChildBookQuery The current query, for fluid interface
@ -301,8 +301,8 @@ abstract class BookQuery extends ModelCriteria
* $query->filterByIsbn('%fooValue%'); // WHERE ISBN LIKE '%fooValue%' * $query->filterByIsbn('%fooValue%'); // WHERE ISBN LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $isbn The value to use as filter. * @param string $isbn The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildBookQuery The current query, for fluid interface * @return ChildBookQuery The current query, for fluid interface
@ -333,10 +333,10 @@ abstract class BookQuery extends ModelCriteria
* *
* @see filterByAuthor() * @see filterByAuthor()
* *
* @param mixed $authorId The value to use as filter. * @param mixed $authorId The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildBookQuery The current query, for fluid interface * @return ChildBookQuery The current query, for fluid interface
@ -447,13 +447,13 @@ abstract class BookQuery extends ModelCriteria
/** /**
* Performs a DELETE on the database, given a ChildBook or Criteria object OR a primary key value. * Performs a DELETE on the database, given a ChildBook or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or ChildBook object or primary key or array of primary keys * @param mixed $values Criteria or ChildBook object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel. * if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {

View file

@ -167,7 +167,7 @@ class BookTableMap extends TableMap
* @param array $row resultset row. * @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row. * @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/ */
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{ {
@ -187,7 +187,7 @@ class BookTableMap extends TableMap
* @param array $row resultset row. * @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row. * @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
* *
* @return mixed The primary key of the row * @return mixed The primary key of the row
*/ */
@ -226,8 +226,8 @@ class BookTableMap extends TableMap
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* *
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
* @return array (Book object, last column rank) * @return array (Book object, last column rank)
*/ */
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{ {
@ -254,7 +254,7 @@ class BookTableMap extends TableMap
* @param DataFetcherInterface $dataFetcher * @param DataFetcherInterface $dataFetcher
* @return array * @return array
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function populateObjects(DataFetcherInterface $dataFetcher) public static function populateObjects(DataFetcherInterface $dataFetcher)
{ {
@ -290,7 +290,7 @@ class BookTableMap extends TableMap
* @param Criteria $criteria object containing the columns to add. * @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias * @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function addSelectColumns(Criteria $criteria, $alias = null) public static function addSelectColumns(Criteria $criteria, $alias = null)
{ {
@ -314,7 +314,7 @@ class BookTableMap extends TableMap
* This method is not needed for general use but a specific application could have a need. * This method is not needed for general use but a specific application could have a need.
* @return TableMap * @return TableMap
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function getTableMap() public static function getTableMap()
{ {
@ -335,13 +335,13 @@ class BookTableMap extends TableMap
/** /**
* Performs a DELETE on the database, given a Book or Criteria object OR a primary key value. * Performs a DELETE on the database, given a Book or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or Book object or primary key or array of primary keys * @param mixed $values Criteria or Book object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel. * if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function doDelete($values, ConnectionInterface $con = null) public static function doDelete($values, ConnectionInterface $con = null)
{ {
@ -389,7 +389,7 @@ class BookTableMap extends TableMap
* @param ConnectionInterface $con the ConnectionInterface connection to use * @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key. * @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function doInsert($criteria, ConnectionInterface $con = null) public static function doInsert($criteria, ConnectionInterface $con = null)
{ {