diff --git a/api/generated-classes/Base/CategoryRankNutrient.php b/api/generated-classes/Base/CategoryRankNutrient.php
index 3bec93d..81c75d6 100644
--- a/api/generated-classes/Base/CategoryRankNutrient.php
+++ b/api/generated-classes/Base/CategoryRankNutrient.php
@@ -115,14 +115,14 @@ abstract class CategoryRankNutrient implements ActiveRecordInterface
protected $nutrient_id;
/**
- * @var ChildNutrient
+ * @var ChildCategory
*/
- protected $aNutrient;
+ protected $aCategory;
/**
- * @var ChildCategory
+ * @var ChildNutrient
*/
- protected $aCategory;
+ protected $aNutrient;
/**
* @var ChildRank
@@ -718,8 +718,8 @@ public function reload($deep = false, ConnectionInterface $con = null)
if ($deep) { // also de-associate any related objects?
- $this->aNutrient = null;
$this->aCategory = null;
+ $this->aNutrient = null;
$this->aRank = null;
} // if (deep)
}
@@ -825,13 +825,6 @@ protected function doSave(ConnectionInterface $con)
// method. This object relates to these object(s) by a
// foreign key reference.
- if ($this->aNutrient !== null) {
- if ($this->aNutrient->isModified() || $this->aNutrient->isNew()) {
- $affectedRows += $this->aNutrient->save($con);
- }
- $this->setNutrient($this->aNutrient);
- }
-
if ($this->aCategory !== null) {
if ($this->aCategory->isModified() || $this->aCategory->isNew()) {
$affectedRows += $this->aCategory->save($con);
@@ -839,6 +832,13 @@ protected function doSave(ConnectionInterface $con)
$this->setCategory($this->aCategory);
}
+ if ($this->aNutrient !== null) {
+ if ($this->aNutrient->isModified() || $this->aNutrient->isNew()) {
+ $affectedRows += $this->aNutrient->save($con);
+ }
+ $this->setNutrient($this->aNutrient);
+ }
+
if ($this->aRank !== null) {
if ($this->aRank->isModified() || $this->aRank->isNew()) {
$affectedRows += $this->aRank->save($con);
@@ -1063,35 +1063,35 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum
}
if ($includeForeignObjects) {
- if (null !== $this->aNutrient) {
+ if (null !== $this->aCategory) {
switch ($keyType) {
case TableMap::TYPE_CAMELNAME:
- $key = 'nutrient';
+ $key = 'category';
break;
case TableMap::TYPE_FIELDNAME:
- $key = 'Nutrient';
+ $key = 'Category';
break;
default:
- $key = 'Nutrient';
+ $key = 'Category';
}
- $result[$key] = $this->aNutrient->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ $result[$key] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->aCategory) {
+ if (null !== $this->aNutrient) {
switch ($keyType) {
case TableMap::TYPE_CAMELNAME:
- $key = 'category';
+ $key = 'nutrient';
break;
case TableMap::TYPE_FIELDNAME:
- $key = 'Category';
+ $key = 'Nutrient';
break;
default:
- $key = 'Category';
+ $key = 'Nutrient';
}
- $result[$key] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ $result[$key] = $this->aNutrient->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->aRank) {
@@ -1393,24 +1393,24 @@ public function copy($deepCopy = false)
}
/**
- * Declares an association between this object and a ChildNutrient object.
+ * Declares an association between this object and a ChildCategory object.
*
- * @param ChildNutrient $v
+ * @param ChildCategory $v
* @return $this|\CategoryRankNutrient The current object (for fluent API support)
* @throws PropelException
*/
- public function setNutrient(ChildNutrient $v = null)
+ public function setCategory(ChildCategory $v = null)
{
if ($v === null) {
- $this->setNutrientId(NULL);
+ $this->setCategoryId(NULL);
} else {
- $this->setNutrientId($v->getId());
+ $this->setCategoryId($v->getId());
}
- $this->aNutrient = $v;
+ $this->aCategory = $v;
// Add binding for other direction of this n:n relationship.
- // If this object has already been added to the ChildNutrient object, it will not be re-added.
+ // If this object has already been added to the ChildCategory object, it will not be re-added.
if ($v !== null) {
$v->addCategoryRankNutrient($this);
}
@@ -1421,47 +1421,47 @@ public function setNutrient(ChildNutrient $v = null)
/**
- * Get the associated ChildNutrient object
+ * Get the associated ChildCategory object
*
* @param ConnectionInterface $con Optional Connection object.
- * @return ChildNutrient The associated ChildNutrient object.
+ * @return ChildCategory The associated ChildCategory object.
* @throws PropelException
*/
- public function getNutrient(ConnectionInterface $con = null)
+ public function getCategory(ConnectionInterface $con = null)
{
- if ($this->aNutrient === null && ($this->nutrient_id !== null)) {
- $this->aNutrient = ChildNutrientQuery::create()->findPk($this->nutrient_id, $con);
+ if ($this->aCategory === null && ($this->category_id !== null)) {
+ $this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
- $this->aNutrient->addCategoryRankNutrients($this);
+ $this->aCategory->addCategoryRankNutrients($this);
*/
}
- return $this->aNutrient;
+ return $this->aCategory;
}
/**
- * Declares an association between this object and a ChildCategory object.
+ * Declares an association between this object and a ChildNutrient object.
*
- * @param ChildCategory $v
+ * @param ChildNutrient $v
* @return $this|\CategoryRankNutrient The current object (for fluent API support)
* @throws PropelException
*/
- public function setCategory(ChildCategory $v = null)
+ public function setNutrient(ChildNutrient $v = null)
{
if ($v === null) {
- $this->setCategoryId(NULL);
+ $this->setNutrientId(NULL);
} else {
- $this->setCategoryId($v->getId());
+ $this->setNutrientId($v->getId());
}
- $this->aCategory = $v;
+ $this->aNutrient = $v;
// Add binding for other direction of this n:n relationship.
- // If this object has already been added to the ChildCategory object, it will not be re-added.
+ // If this object has already been added to the ChildNutrient object, it will not be re-added.
if ($v !== null) {
$v->addCategoryRankNutrient($this);
}
@@ -1472,26 +1472,26 @@ public function setCategory(ChildCategory $v = null)
/**
- * Get the associated ChildCategory object
+ * Get the associated ChildNutrient object
*
* @param ConnectionInterface $con Optional Connection object.
- * @return ChildCategory The associated ChildCategory object.
+ * @return ChildNutrient The associated ChildNutrient object.
* @throws PropelException
*/
- public function getCategory(ConnectionInterface $con = null)
+ public function getNutrient(ConnectionInterface $con = null)
{
- if ($this->aCategory === null && ($this->category_id !== null)) {
- $this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con);
+ if ($this->aNutrient === null && ($this->nutrient_id !== null)) {
+ $this->aNutrient = ChildNutrientQuery::create()->findPk($this->nutrient_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
- $this->aCategory->addCategoryRankNutrients($this);
+ $this->aNutrient->addCategoryRankNutrients($this);
*/
}
- return $this->aCategory;
+ return $this->aNutrient;
}
/**
@@ -1552,12 +1552,12 @@ public function getRank(ConnectionInterface $con = null)
*/
public function clear()
{
- if (null !== $this->aNutrient) {
- $this->aNutrient->removeCategoryRankNutrient($this);
- }
if (null !== $this->aCategory) {
$this->aCategory->removeCategoryRankNutrient($this);
}
+ if (null !== $this->aNutrient) {
+ $this->aNutrient->removeCategoryRankNutrient($this);
+ }
if (null !== $this->aRank) {
$this->aRank->removeCategoryRankNutrient($this);
}
@@ -1588,8 +1588,8 @@ public function clearAllReferences($deep = false)
if ($deep) {
} // if ($deep)
- $this->aNutrient = null;
$this->aCategory = null;
+ $this->aNutrient = null;
$this->aRank = null;
}
diff --git a/api/generated-classes/Base/CategoryRankNutrientQuery.php b/api/generated-classes/Base/CategoryRankNutrientQuery.php
index 832818e..1bcaaff 100644
--- a/api/generated-classes/Base/CategoryRankNutrientQuery.php
+++ b/api/generated-classes/Base/CategoryRankNutrientQuery.php
@@ -44,16 +44,6 @@
* @method ChildCategoryRankNutrientQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query
* @method ChildCategoryRankNutrientQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query
*
- * @method ChildCategoryRankNutrientQuery leftJoinNutrient($relationAlias = null) Adds a LEFT JOIN clause to the query using the Nutrient relation
- * @method ChildCategoryRankNutrientQuery rightJoinNutrient($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Nutrient relation
- * @method ChildCategoryRankNutrientQuery innerJoinNutrient($relationAlias = null) Adds a INNER JOIN clause to the query using the Nutrient relation
- *
- * @method ChildCategoryRankNutrientQuery joinWithNutrient($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the Nutrient relation
- *
- * @method ChildCategoryRankNutrientQuery leftJoinWithNutrient() Adds a LEFT JOIN clause and with to the query using the Nutrient relation
- * @method ChildCategoryRankNutrientQuery rightJoinWithNutrient() Adds a RIGHT JOIN clause and with to the query using the Nutrient relation
- * @method ChildCategoryRankNutrientQuery innerJoinWithNutrient() Adds a INNER JOIN clause and with to the query using the Nutrient relation
- *
* @method ChildCategoryRankNutrientQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
* @method ChildCategoryRankNutrientQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
* @method ChildCategoryRankNutrientQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
@@ -64,6 +54,16 @@
* @method ChildCategoryRankNutrientQuery rightJoinWithCategory() Adds a RIGHT JOIN clause and with to the query using the Category relation
* @method ChildCategoryRankNutrientQuery innerJoinWithCategory() Adds a INNER JOIN clause and with to the query using the Category relation
*
+ * @method ChildCategoryRankNutrientQuery leftJoinNutrient($relationAlias = null) Adds a LEFT JOIN clause to the query using the Nutrient relation
+ * @method ChildCategoryRankNutrientQuery rightJoinNutrient($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Nutrient relation
+ * @method ChildCategoryRankNutrientQuery innerJoinNutrient($relationAlias = null) Adds a INNER JOIN clause to the query using the Nutrient relation
+ *
+ * @method ChildCategoryRankNutrientQuery joinWithNutrient($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the Nutrient relation
+ *
+ * @method ChildCategoryRankNutrientQuery leftJoinWithNutrient() Adds a LEFT JOIN clause and with to the query using the Nutrient relation
+ * @method ChildCategoryRankNutrientQuery rightJoinWithNutrient() Adds a RIGHT JOIN clause and with to the query using the Nutrient relation
+ * @method ChildCategoryRankNutrientQuery innerJoinWithNutrient() Adds a INNER JOIN clause and with to the query using the Nutrient relation
+ *
* @method ChildCategoryRankNutrientQuery leftJoinRank($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rank relation
* @method ChildCategoryRankNutrientQuery rightJoinRank($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rank relation
* @method ChildCategoryRankNutrientQuery innerJoinRank($relationAlias = null) Adds a INNER JOIN clause to the query using the Rank relation
@@ -74,7 +74,7 @@
* @method ChildCategoryRankNutrientQuery rightJoinWithRank() Adds a RIGHT JOIN clause and with to the query using the Rank relation
* @method ChildCategoryRankNutrientQuery innerJoinWithRank() Adds a INNER JOIN clause and with to the query using the Rank relation
*
- * @method \NutrientQuery|\CategoryQuery|\RankQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria
+ * @method \CategoryQuery|\NutrientQuery|\RankQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria
*
* @method ChildCategoryRankNutrient findOne(ConnectionInterface $con = null) Return the first ChildCategoryRankNutrient matching the query
* @method ChildCategoryRankNutrient findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCategoryRankNutrient matching the query, or a new ChildCategoryRankNutrient object populated from the query conditions when no match is found
@@ -556,44 +556,44 @@ public function filterByNutrientId($nutrientId = null, $comparison = null)
}
/**
- * Filter the query by a related \Nutrient object
+ * Filter the query by a related \Category object
*
- * @param \Nutrient|ObjectCollection $nutrient The related object(s) to use as filter
+ * @param \Category|ObjectCollection $category The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @throws \Propel\Runtime\Exception\PropelException
*
* @return ChildCategoryRankNutrientQuery The current query, for fluid interface
*/
- public function filterByNutrient($nutrient, $comparison = null)
+ public function filterByCategory($category, $comparison = null)
{
- if ($nutrient instanceof \Nutrient) {
+ if ($category instanceof \Category) {
return $this
- ->addUsingAlias(CategoryRankNutrientTableMap::COL_NUTRIENT_ID, $nutrient->getId(), $comparison);
- } elseif ($nutrient instanceof ObjectCollection) {
+ ->addUsingAlias(CategoryRankNutrientTableMap::COL_CATEGORY_ID, $category->getId(), $comparison);
+ } elseif ($category instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
- ->addUsingAlias(CategoryRankNutrientTableMap::COL_NUTRIENT_ID, $nutrient->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ ->addUsingAlias(CategoryRankNutrientTableMap::COL_CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
- throw new PropelException('filterByNutrient() only accepts arguments of type \Nutrient or Collection');
+ throw new PropelException('filterByCategory() only accepts arguments of type \Category or Collection');
}
}
/**
- * Adds a JOIN clause to the query using the Nutrient relation
+ * Adds a JOIN clause to the query using the Category relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return $this|ChildCategoryRankNutrientQuery The current query, for fluid interface
*/
- public function joinNutrient($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('Nutrient');
+ $relationMap = $tableMap->getRelation('Category');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -608,14 +608,14 @@ public function joinNutrient($relationAlias = null, $joinType = Criteria::INNER_
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'Nutrient');
+ $this->addJoinObject($join, 'Category');
}
return $this;
}
/**
- * Use the Nutrient relation Nutrient object
+ * Use the Category relation Category object
*
* @see useQuery()
*
@@ -623,54 +623,54 @@ public function joinNutrient($relationAlias = null, $joinType = Criteria::INNER_
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \NutrientQuery A secondary query class using the current class as primary query
+ * @return \CategoryQuery A secondary query class using the current class as primary query
*/
- public function useNutrientQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
- ->joinNutrient($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'Nutrient', '\NutrientQuery');
+ ->joinCategory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Category', '\CategoryQuery');
}
/**
- * Filter the query by a related \Category object
+ * Filter the query by a related \Nutrient object
*
- * @param \Category|ObjectCollection $category The related object(s) to use as filter
+ * @param \Nutrient|ObjectCollection $nutrient The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @throws \Propel\Runtime\Exception\PropelException
*
* @return ChildCategoryRankNutrientQuery The current query, for fluid interface
*/
- public function filterByCategory($category, $comparison = null)
+ public function filterByNutrient($nutrient, $comparison = null)
{
- if ($category instanceof \Category) {
+ if ($nutrient instanceof \Nutrient) {
return $this
- ->addUsingAlias(CategoryRankNutrientTableMap::COL_CATEGORY_ID, $category->getId(), $comparison);
- } elseif ($category instanceof ObjectCollection) {
+ ->addUsingAlias(CategoryRankNutrientTableMap::COL_NUTRIENT_ID, $nutrient->getId(), $comparison);
+ } elseif ($nutrient instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
- ->addUsingAlias(CategoryRankNutrientTableMap::COL_CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ ->addUsingAlias(CategoryRankNutrientTableMap::COL_NUTRIENT_ID, $nutrient->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
- throw new PropelException('filterByCategory() only accepts arguments of type \Category or Collection');
+ throw new PropelException('filterByNutrient() only accepts arguments of type \Nutrient or Collection');
}
}
/**
- * Adds a JOIN clause to the query using the Category relation
+ * Adds a JOIN clause to the query using the Nutrient relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return $this|ChildCategoryRankNutrientQuery The current query, for fluid interface
*/
- public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinNutrient($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('Category');
+ $relationMap = $tableMap->getRelation('Nutrient');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -685,14 +685,14 @@ public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'Category');
+ $this->addJoinObject($join, 'Nutrient');
}
return $this;
}
/**
- * Use the Category relation Category object
+ * Use the Nutrient relation Nutrient object
*
* @see useQuery()
*
@@ -700,13 +700,13 @@ public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \CategoryQuery A secondary query class using the current class as primary query
+ * @return \NutrientQuery A secondary query class using the current class as primary query
*/
- public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useNutrientQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
- ->joinCategory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'Category', '\CategoryQuery');
+ ->joinNutrient($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Nutrient', '\NutrientQuery');
}
/**
diff --git a/api/generated-classes/Base/Food.php b/api/generated-classes/Base/Food.php
index 38bb5bc..f978666 100644
--- a/api/generated-classes/Base/Food.php
+++ b/api/generated-classes/Base/Food.php
@@ -80,7 +80,8 @@ abstract class Food implements ActiveRecordInterface
/**
* The value for the barcode field.
*
- * @var int
+ * Note: this column has a database default value of: ''
+ * @var string
*/
protected $barcode;
@@ -116,11 +117,24 @@ abstract class Food implements ActiveRecordInterface
*/
protected $alreadyInSave = false;
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->barcode = '';
+ }
+
/**
* Initializes internal state of Base\Food object.
+ * @see applyDefaults()
*/
public function __construct()
{
+ $this->applyDefaultValues();
}
/**
@@ -364,7 +378,7 @@ public function getName()
/**
* Get the [barcode] column value.
*
- * @return int
+ * @return string
*/
public function getBarcode()
{
@@ -434,13 +448,13 @@ public function setName($v)
/**
* Set the value of [barcode] column.
*
- * @param int $v new value
+ * @param string $v new value
* @return $this|\Food The current object (for fluent API support)
*/
public function setBarcode($v)
{
if ($v !== null) {
- $v = (int) $v;
+ $v = (string) $v;
}
if ($this->barcode !== $v) {
@@ -509,6 +523,10 @@ public function setCategoryId($v)
*/
public function hasOnlyDefaultValues()
{
+ if ($this->barcode !== '') {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -542,7 +560,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta
$this->name = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FoodTableMap::translateFieldName('Barcode', TableMap::TYPE_PHPNAME, $indexType)];
- $this->barcode = (null !== $col) ? (int) $col : null;
+ $this->barcode = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FoodTableMap::translateFieldName('RankId', TableMap::TYPE_PHPNAME, $indexType)];
$this->rank_id = (null !== $col) ? (int) $col : null;
@@ -814,7 +832,7 @@ protected function doInsert(ConnectionInterface $con)
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
break;
case 'barcode':
- $stmt->bindValue($identifier, $this->barcode, PDO::PARAM_INT);
+ $stmt->bindValue($identifier, $this->barcode, PDO::PARAM_STR);
break;
case 'rank_id':
$stmt->bindValue($identifier, $this->rank_id, PDO::PARAM_INT);
@@ -1357,6 +1375,7 @@ public function clear()
$this->category_id = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
+ $this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
diff --git a/api/generated-classes/Base/FoodQuery.php b/api/generated-classes/Base/FoodQuery.php
index 19211a4..039dc4c 100644
--- a/api/generated-classes/Base/FoodQuery.php
+++ b/api/generated-classes/Base/FoodQuery.php
@@ -67,7 +67,7 @@
*
* @method ChildFood findOneById(int $id) Return the first ChildFood filtered by the id column
* @method ChildFood findOneByName(string $name) Return the first ChildFood filtered by the name column
- * @method ChildFood findOneByBarcode(int $barcode) Return the first ChildFood filtered by the barcode column
+ * @method ChildFood findOneByBarcode(string $barcode) Return the first ChildFood filtered by the barcode column
* @method ChildFood findOneByRankId(int $rank_id) Return the first ChildFood filtered by the rank_id column
* @method ChildFood findOneByCategoryId(int $category_id) Return the first ChildFood filtered by the category_id column *
@@ -76,14 +76,14 @@
*
* @method ChildFood requireOneById(int $id) Return the first ChildFood filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
* @method ChildFood requireOneByName(string $name) Return the first ChildFood filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
- * @method ChildFood requireOneByBarcode(int $barcode) Return the first ChildFood filtered by the barcode column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
+ * @method ChildFood requireOneByBarcode(string $barcode) Return the first ChildFood filtered by the barcode column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
* @method ChildFood requireOneByRankId(int $rank_id) Return the first ChildFood filtered by the rank_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
* @method ChildFood requireOneByCategoryId(int $category_id) Return the first ChildFood filtered by the category_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
*
* @method ChildFood[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildFood objects based on current ModelCriteria
* @method ChildFood[]|ObjectCollection findById(int $id) Return ChildFood objects filtered by the id column
* @method ChildFood[]|ObjectCollection findByName(string $name) Return ChildFood objects filtered by the name column
- * @method ChildFood[]|ObjectCollection findByBarcode(int $barcode) Return ChildFood objects filtered by the barcode column
+ * @method ChildFood[]|ObjectCollection findByBarcode(string $barcode) Return ChildFood objects filtered by the barcode column
* @method ChildFood[]|ObjectCollection findByRankId(int $rank_id) Return ChildFood objects filtered by the rank_id column
* @method ChildFood[]|ObjectCollection findByCategoryId(int $category_id) Return ChildFood objects filtered by the category_id column
* @method ChildFood[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit
@@ -345,35 +345,19 @@ public function filterByName($name = null, $comparison = null)
*
* Example usage:
*
- * $query->filterByBarcode(1234); // WHERE barcode = 1234
- * $query->filterByBarcode(array(12, 34)); // WHERE barcode IN (12, 34)
- * $query->filterByBarcode(array('min' => 12)); // WHERE barcode > 12
+ * $query->filterByBarcode('fooValue'); // WHERE barcode = 'fooValue'
+ * $query->filterByBarcode('%fooValue%', Criteria::LIKE); // WHERE barcode LIKE '%fooValue%'
*
*
- * @param mixed $barcode The value to use as filter.
- * Use scalar values for equality.
- * Use array values for in_array() equivalent.
- * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $barcode The value to use as filter.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return $this|ChildFoodQuery The current query, for fluid interface
*/
public function filterByBarcode($barcode = null, $comparison = null)
{
- if (is_array($barcode)) {
- $useMinMax = false;
- if (isset($barcode['min'])) {
- $this->addUsingAlias(FoodTableMap::COL_BARCODE, $barcode['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($barcode['max'])) {
- $this->addUsingAlias(FoodTableMap::COL_BARCODE, $barcode['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($barcode)) {
$comparison = Criteria::IN;
}
}
diff --git a/api/generated-classes/Base/Rank.php b/api/generated-classes/Base/Rank.php
index 164de22..10e0a75 100644
--- a/api/generated-classes/Base/Rank.php
+++ b/api/generated-classes/Base/Rank.php
@@ -1358,10 +1358,10 @@ public function removeCategoryRankNutrient(ChildCategoryRankNutrient $categoryRa
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return ObjectCollection|ChildCategoryRankNutrient[] List of ChildCategoryRankNutrient objects
*/
- public function getCategoryRankNutrientsJoinNutrient(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ public function getCategoryRankNutrientsJoinCategory(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildCategoryRankNutrientQuery::create(null, $criteria);
- $query->joinWith('Nutrient', $joinBehavior);
+ $query->joinWith('Category', $joinBehavior);
return $this->getCategoryRankNutrients($query, $con);
}
@@ -1383,10 +1383,10 @@ public function getCategoryRankNutrientsJoinNutrient(Criteria $criteria = null,
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return ObjectCollection|ChildCategoryRankNutrient[] List of ChildCategoryRankNutrient objects
*/
- public function getCategoryRankNutrientsJoinCategory(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ public function getCategoryRankNutrientsJoinNutrient(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildCategoryRankNutrientQuery::create(null, $criteria);
- $query->joinWith('Category', $joinBehavior);
+ $query->joinWith('Nutrient', $joinBehavior);
return $this->getCategoryRankNutrients($query, $con);
}
diff --git a/api/generated-classes/Map/CategoryRankNutrientTableMap.php b/api/generated-classes/Map/CategoryRankNutrientTableMap.php
index a9ee395..4504bbc 100644
--- a/api/generated-classes/Map/CategoryRankNutrientTableMap.php
+++ b/api/generated-classes/Map/CategoryRankNutrientTableMap.php
@@ -170,17 +170,17 @@ public function initialize()
*/
public function buildRelations()
{
- $this->addRelation('Nutrient', '\\Nutrient', RelationMap::MANY_TO_ONE, array (
+ $this->addRelation('Category', '\\Category', RelationMap::MANY_TO_ONE, array (
0 =>
array (
- 0 => ':nutrient_id',
+ 0 => ':category_id',
1 => ':id',
),
), 'CASCADE', 'CASCADE', null, false);
- $this->addRelation('Category', '\\Category', RelationMap::MANY_TO_ONE, array (
+ $this->addRelation('Nutrient', '\\Nutrient', RelationMap::MANY_TO_ONE, array (
0 =>
array (
- 0 => ':category_id',
+ 0 => ':nutrient_id',
1 => ':id',
),
), 'CASCADE', 'CASCADE', null, false);
diff --git a/api/generated-classes/Map/FoodTableMap.php b/api/generated-classes/Map/FoodTableMap.php
index cb0c787..3e540d3 100644
--- a/api/generated-classes/Map/FoodTableMap.php
+++ b/api/generated-classes/Map/FoodTableMap.php
@@ -148,7 +148,7 @@ public function initialize()
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('name', 'Name', 'VARCHAR', true, 255, null);
- $this->addColumn('barcode', 'Barcode', 'INTEGER', true, null, null);
+ $this->addColumn('barcode', 'Barcode', 'VARCHAR', true, 11, '');
$this->addForeignKey('rank_id', 'RankId', 'INTEGER', 'Rank', 'id', false, null, null);
$this->addForeignKey('category_id', 'CategoryId', 'INTEGER', 'Category', 'id', false, null, null);
} // initialize()
diff --git a/api/generated-conf/config.php b/api/generated-conf/config.php
index 6d7b92f..30bb12d 100644
--- a/api/generated-conf/config.php
+++ b/api/generated-conf/config.php
@@ -9,7 +9,7 @@
'password' => 'foodbank123',
'settings' =>
array (
- 'charset' => 'utf8',
+ 'charset' => 'utf8mb4_unicode_ci',
'queries' =>
array (
),
diff --git a/api/generated-sql/default.sql b/api/generated-sql/default.sql
index 1dd54e8..4a2aa14 100644
--- a/api/generated-sql/default.sql
+++ b/api/generated-sql/default.sql
@@ -35,17 +35,17 @@ CREATE TABLE `Category_Rank_Nutrient`
INDEX `category_id` (`category_id`),
INDEX `rank_id` (`rank_id`),
INDEX `nutrient_id` (`nutrient_id`),
- CONSTRAINT `Category_Rank_Nutrient_ibfk_3`
- FOREIGN KEY (`nutrient_id`)
- REFERENCES `Nutrient` (`id`)
- ON UPDATE CASCADE
- ON DELETE CASCADE,
- CONSTRAINT `Category_Rank_Nutrient_ibfk_1`
+ CONSTRAINT `Category_Rank_Nutrient_ibfk_cat`
FOREIGN KEY (`category_id`)
REFERENCES `Category` (`id`)
ON UPDATE CASCADE
ON DELETE CASCADE,
- CONSTRAINT `Category_Rank_Nutrient_ibfk_2`
+ CONSTRAINT `Category_Rank_Nutrient_ibfk_nut`
+ FOREIGN KEY (`nutrient_id`)
+ REFERENCES `Nutrient` (`id`)
+ ON UPDATE CASCADE
+ ON DELETE CASCADE,
+ CONSTRAINT `Category_Rank_Nutrient_ibfk_rank`
FOREIGN KEY (`rank_id`)
REFERENCES `Rank` (`id`)
ON UPDATE CASCADE
@@ -62,7 +62,7 @@ CREATE TABLE `Food`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
- `barcode` INTEGER NOT NULL,
+ `barcode` VARCHAR(11) DEFAULT '' NOT NULL,
`rank_id` INTEGER,
`category_id` INTEGER,
PRIMARY KEY (`id`),
@@ -104,7 +104,8 @@ CREATE TABLE `Rank`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(128) NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ INDEX `id` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
diff --git a/api/propel.yml.dist b/api/propel.yml.dist
index 1a6809d..567b5f9 100644
--- a/api/propel.yml.dist
+++ b/api/propel.yml.dist
@@ -12,7 +12,7 @@ propel:
schemaDir: /Users/brian/Documents/Sites/foodbank/api
# The directory where Propel should output generated object model classes.
- phpDir: /Users/brian/Documents/Sites/foodbank/api
+ phpDir: /Users/brian/Documents/Sites/foodbank/api/generated-classes
# database:
# connections:
diff --git a/api/schema.xml b/api/schema.xml
index 099723a..4350134 100644
--- a/api/schema.xml
+++ b/api/schema.xml
@@ -15,13 +15,13 @@
-
-
-
-
+
-
+
+
+
+
@@ -40,7 +40,7 @@