address loop
title loop
This commit is contained in:
@@ -21,6 +21,8 @@ use Thelia\Model\Address as ChildAddress;
|
||||
use Thelia\Model\AddressQuery as ChildAddressQuery;
|
||||
use Thelia\Model\Cart as ChildCart;
|
||||
use Thelia\Model\CartQuery as ChildCartQuery;
|
||||
use Thelia\Model\Country as ChildCountry;
|
||||
use Thelia\Model\CountryQuery as ChildCountryQuery;
|
||||
use Thelia\Model\Customer as ChildCustomer;
|
||||
use Thelia\Model\CustomerQuery as ChildCustomerQuery;
|
||||
use Thelia\Model\CustomerTitle as ChildCustomerTitle;
|
||||
@@ -68,10 +70,10 @@ abstract class Address implements ActiveRecordInterface
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the title field.
|
||||
* The value for the name field.
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* The value for the customer_id field.
|
||||
@@ -80,10 +82,10 @@ abstract class Address implements ActiveRecordInterface
|
||||
protected $customer_id;
|
||||
|
||||
/**
|
||||
* The value for the customer_title_id field.
|
||||
* The value for the title_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $customer_title_id;
|
||||
protected $title_id;
|
||||
|
||||
/**
|
||||
* The value for the company field.
|
||||
@@ -180,6 +182,11 @@ abstract class Address implements ActiveRecordInterface
|
||||
*/
|
||||
protected $aCustomerTitle;
|
||||
|
||||
/**
|
||||
* @var Country
|
||||
*/
|
||||
protected $aCountry;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCart[] Collection to store aggregation of ChildCart objects.
|
||||
*/
|
||||
@@ -491,14 +498,14 @@ abstract class Address implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [title] column value.
|
||||
* Get the [name] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getName()
|
||||
{
|
||||
|
||||
return $this->title;
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -513,14 +520,14 @@ abstract class Address implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [customer_title_id] column value.
|
||||
* Get the [title_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCustomerTitleId()
|
||||
public function getTitleId()
|
||||
{
|
||||
|
||||
return $this->customer_title_id;
|
||||
return $this->title_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,25 +724,25 @@ abstract class Address implements ActiveRecordInterface
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [title] column.
|
||||
* Set the value of [name] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Address The current object (for fluent API support)
|
||||
*/
|
||||
public function setTitle($v)
|
||||
public function setName($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->title !== $v) {
|
||||
$this->title = $v;
|
||||
$this->modifiedColumns[] = AddressTableMap::TITLE;
|
||||
if ($this->name !== $v) {
|
||||
$this->name = $v;
|
||||
$this->modifiedColumns[] = AddressTableMap::NAME;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setTitle()
|
||||
} // setName()
|
||||
|
||||
/**
|
||||
* Set the value of [customer_id] column.
|
||||
@@ -763,20 +770,20 @@ abstract class Address implements ActiveRecordInterface
|
||||
} // setCustomerId()
|
||||
|
||||
/**
|
||||
* Set the value of [customer_title_id] column.
|
||||
* Set the value of [title_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\Address The current object (for fluent API support)
|
||||
*/
|
||||
public function setCustomerTitleId($v)
|
||||
public function setTitleId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->customer_title_id !== $v) {
|
||||
$this->customer_title_id = $v;
|
||||
$this->modifiedColumns[] = AddressTableMap::CUSTOMER_TITLE_ID;
|
||||
if ($this->title_id !== $v) {
|
||||
$this->title_id = $v;
|
||||
$this->modifiedColumns[] = AddressTableMap::TITLE_ID;
|
||||
}
|
||||
|
||||
if ($this->aCustomerTitle !== null && $this->aCustomerTitle->getId() !== $v) {
|
||||
@@ -785,7 +792,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCustomerTitleId()
|
||||
} // setTitleId()
|
||||
|
||||
/**
|
||||
* Set the value of [company] column.
|
||||
@@ -972,6 +979,10 @@ abstract class Address implements ActiveRecordInterface
|
||||
$this->modifiedColumns[] = AddressTableMap::COUNTRY_ID;
|
||||
}
|
||||
|
||||
if ($this->aCountry !== null && $this->aCountry->getId() !== $v) {
|
||||
$this->aCountry = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCountryId()
|
||||
@@ -1125,14 +1136,14 @@ abstract class Address implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AddressTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->title = (null !== $col) ? (string) $col : null;
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->name = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AddressTableMap::translateFieldName('CustomerId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->customer_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AddressTableMap::translateFieldName('CustomerTitleId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->customer_title_id = (null !== $col) ? (int) $col : null;
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AddressTableMap::translateFieldName('TitleId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->title_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AddressTableMap::translateFieldName('Company', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->company = (null !== $col) ? (string) $col : null;
|
||||
@@ -1214,9 +1225,12 @@ abstract class Address implements ActiveRecordInterface
|
||||
if ($this->aCustomer !== null && $this->customer_id !== $this->aCustomer->getId()) {
|
||||
$this->aCustomer = null;
|
||||
}
|
||||
if ($this->aCustomerTitle !== null && $this->customer_title_id !== $this->aCustomerTitle->getId()) {
|
||||
if ($this->aCustomerTitle !== null && $this->title_id !== $this->aCustomerTitle->getId()) {
|
||||
$this->aCustomerTitle = null;
|
||||
}
|
||||
if ($this->aCountry !== null && $this->country_id !== $this->aCountry->getId()) {
|
||||
$this->aCountry = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -1258,6 +1272,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
|
||||
$this->aCustomer = null;
|
||||
$this->aCustomerTitle = null;
|
||||
$this->aCountry = null;
|
||||
$this->collCartsRelatedByAddressDeliveryId = null;
|
||||
|
||||
$this->collCartsRelatedByAddressInvoiceId = null;
|
||||
@@ -1403,6 +1418,13 @@ abstract class Address implements ActiveRecordInterface
|
||||
$this->setCustomerTitle($this->aCustomerTitle);
|
||||
}
|
||||
|
||||
if ($this->aCountry !== null) {
|
||||
if ($this->aCountry->isModified() || $this->aCountry->isNew()) {
|
||||
$affectedRows += $this->aCountry->save($con);
|
||||
}
|
||||
$this->setCountry($this->aCountry);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -1479,14 +1501,14 @@ abstract class Address implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AddressTableMap::ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ID';
|
||||
}
|
||||
if ($this->isColumnModified(AddressTableMap::TITLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TITLE';
|
||||
if ($this->isColumnModified(AddressTableMap::NAME)) {
|
||||
$modifiedColumns[':p' . $index++] = 'NAME';
|
||||
}
|
||||
if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CUSTOMER_ID';
|
||||
}
|
||||
if ($this->isColumnModified(AddressTableMap::CUSTOMER_TITLE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CUSTOMER_TITLE_ID';
|
||||
if ($this->isColumnModified(AddressTableMap::TITLE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TITLE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(AddressTableMap::COMPANY)) {
|
||||
$modifiedColumns[':p' . $index++] = 'COMPANY';
|
||||
@@ -1544,14 +1566,14 @@ abstract class Address implements ActiveRecordInterface
|
||||
case 'ID':
|
||||
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'TITLE':
|
||||
$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
|
||||
case 'NAME':
|
||||
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CUSTOMER_ID':
|
||||
$stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CUSTOMER_TITLE_ID':
|
||||
$stmt->bindValue($identifier, $this->customer_title_id, PDO::PARAM_INT);
|
||||
case 'TITLE_ID':
|
||||
$stmt->bindValue($identifier, $this->title_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'COMPANY':
|
||||
$stmt->bindValue($identifier, $this->company, PDO::PARAM_STR);
|
||||
@@ -1661,13 +1683,13 @@ abstract class Address implements ActiveRecordInterface
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getTitle();
|
||||
return $this->getName();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getCustomerId();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getCustomerTitleId();
|
||||
return $this->getTitleId();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getCompany();
|
||||
@@ -1741,9 +1763,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
$keys = AddressTableMap::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getTitle(),
|
||||
$keys[1] => $this->getName(),
|
||||
$keys[2] => $this->getCustomerId(),
|
||||
$keys[3] => $this->getCustomerTitleId(),
|
||||
$keys[3] => $this->getTitleId(),
|
||||
$keys[4] => $this->getCompany(),
|
||||
$keys[5] => $this->getFirstname(),
|
||||
$keys[6] => $this->getLastname(),
|
||||
@@ -1772,6 +1794,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
if (null !== $this->aCustomerTitle) {
|
||||
$result['CustomerTitle'] = $this->aCustomerTitle->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->aCountry) {
|
||||
$result['Country'] = $this->aCountry->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->collCartsRelatedByAddressDeliveryId) {
|
||||
$result['CartsRelatedByAddressDeliveryId'] = $this->collCartsRelatedByAddressDeliveryId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
@@ -1816,13 +1841,13 @@ abstract class Address implements ActiveRecordInterface
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setTitle($value);
|
||||
$this->setName($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setCustomerId($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setCustomerTitleId($value);
|
||||
$this->setTitleId($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setCompany($value);
|
||||
@@ -1891,9 +1916,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
$keys = AddressTableMap::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setTitle($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setCustomerId($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setCustomerTitleId($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setTitleId($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCompany($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setFirstname($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setLastname($arr[$keys[6]]);
|
||||
@@ -1920,9 +1945,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
$criteria = new Criteria(AddressTableMap::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AddressTableMap::ID)) $criteria->add(AddressTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(AddressTableMap::TITLE)) $criteria->add(AddressTableMap::TITLE, $this->title);
|
||||
if ($this->isColumnModified(AddressTableMap::NAME)) $criteria->add(AddressTableMap::NAME, $this->name);
|
||||
if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) $criteria->add(AddressTableMap::CUSTOMER_ID, $this->customer_id);
|
||||
if ($this->isColumnModified(AddressTableMap::CUSTOMER_TITLE_ID)) $criteria->add(AddressTableMap::CUSTOMER_TITLE_ID, $this->customer_title_id);
|
||||
if ($this->isColumnModified(AddressTableMap::TITLE_ID)) $criteria->add(AddressTableMap::TITLE_ID, $this->title_id);
|
||||
if ($this->isColumnModified(AddressTableMap::COMPANY)) $criteria->add(AddressTableMap::COMPANY, $this->company);
|
||||
if ($this->isColumnModified(AddressTableMap::FIRSTNAME)) $criteria->add(AddressTableMap::FIRSTNAME, $this->firstname);
|
||||
if ($this->isColumnModified(AddressTableMap::LASTNAME)) $criteria->add(AddressTableMap::LASTNAME, $this->lastname);
|
||||
@@ -2000,9 +2025,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setTitle($this->getTitle());
|
||||
$copyObj->setName($this->getName());
|
||||
$copyObj->setCustomerId($this->getCustomerId());
|
||||
$copyObj->setCustomerTitleId($this->getCustomerTitleId());
|
||||
$copyObj->setTitleId($this->getTitleId());
|
||||
$copyObj->setCompany($this->getCompany());
|
||||
$copyObj->setFirstname($this->getFirstname());
|
||||
$copyObj->setLastname($this->getLastname());
|
||||
@@ -2126,9 +2151,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
public function setCustomerTitle(ChildCustomerTitle $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setCustomerTitleId(NULL);
|
||||
$this->setTitleId(NULL);
|
||||
} else {
|
||||
$this->setCustomerTitleId($v->getId());
|
||||
$this->setTitleId($v->getId());
|
||||
}
|
||||
|
||||
$this->aCustomerTitle = $v;
|
||||
@@ -2153,8 +2178,8 @@ abstract class Address implements ActiveRecordInterface
|
||||
*/
|
||||
public function getCustomerTitle(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->aCustomerTitle === null && ($this->customer_title_id !== null)) {
|
||||
$this->aCustomerTitle = ChildCustomerTitleQuery::create()->findPk($this->customer_title_id, $con);
|
||||
if ($this->aCustomerTitle === null && ($this->title_id !== null)) {
|
||||
$this->aCustomerTitle = ChildCustomerTitleQuery::create()->findPk($this->title_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
|
||||
@@ -2167,6 +2192,57 @@ abstract class Address implements ActiveRecordInterface
|
||||
return $this->aCustomerTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a ChildCountry object.
|
||||
*
|
||||
* @param ChildCountry $v
|
||||
* @return \Thelia\Model\Address The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCountry(ChildCountry $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setCountryId(NULL);
|
||||
} else {
|
||||
$this->setCountryId($v->getId());
|
||||
}
|
||||
|
||||
$this->aCountry = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the ChildCountry object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addAddress($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated ChildCountry object
|
||||
*
|
||||
* @param ConnectionInterface $con Optional Connection object.
|
||||
* @return ChildCountry The associated ChildCountry object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCountry(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->aCountry === null && ($this->country_id !== null)) {
|
||||
$this->aCountry = ChildCountryQuery::create()->findPk($this->country_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->aCountry->addAddresses($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aCountry;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
@@ -2728,9 +2804,9 @@ abstract class Address implements ActiveRecordInterface
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->title = null;
|
||||
$this->name = null;
|
||||
$this->customer_id = null;
|
||||
$this->customer_title_id = null;
|
||||
$this->title_id = null;
|
||||
$this->company = null;
|
||||
$this->firstname = null;
|
||||
$this->lastname = null;
|
||||
@@ -2787,6 +2863,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
$this->collCartsRelatedByAddressInvoiceId = null;
|
||||
$this->aCustomer = null;
|
||||
$this->aCustomerTitle = null;
|
||||
$this->aCountry = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,9 +22,9 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
*
|
||||
*
|
||||
* @method ChildAddressQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAddressQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
||||
* @method ChildAddressQuery orderByName($order = Criteria::ASC) Order by the name column
|
||||
* @method ChildAddressQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
|
||||
* @method ChildAddressQuery orderByCustomerTitleId($order = Criteria::ASC) Order by the customer_title_id column
|
||||
* @method ChildAddressQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column
|
||||
* @method ChildAddressQuery orderByCompany($order = Criteria::ASC) Order by the company column
|
||||
* @method ChildAddressQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
||||
* @method ChildAddressQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
@@ -41,9 +41,9 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildAddressQuery groupById() Group by the id column
|
||||
* @method ChildAddressQuery groupByTitle() Group by the title column
|
||||
* @method ChildAddressQuery groupByName() Group by the name column
|
||||
* @method ChildAddressQuery groupByCustomerId() Group by the customer_id column
|
||||
* @method ChildAddressQuery groupByCustomerTitleId() Group by the customer_title_id column
|
||||
* @method ChildAddressQuery groupByTitleId() Group by the title_id column
|
||||
* @method ChildAddressQuery groupByCompany() Group by the company column
|
||||
* @method ChildAddressQuery groupByFirstname() Group by the firstname column
|
||||
* @method ChildAddressQuery groupByLastname() Group by the lastname column
|
||||
@@ -71,6 +71,10 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddressQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
|
||||
* @method ChildAddressQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
|
||||
*
|
||||
* @method ChildAddressQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
|
||||
* @method ChildAddressQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
|
||||
* @method ChildAddressQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @method ChildAddressQuery leftJoinCartRelatedByAddressDeliveryId($relationAlias = null) Adds a LEFT JOIN clause to the query using the CartRelatedByAddressDeliveryId relation
|
||||
* @method ChildAddressQuery rightJoinCartRelatedByAddressDeliveryId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CartRelatedByAddressDeliveryId relation
|
||||
* @method ChildAddressQuery innerJoinCartRelatedByAddressDeliveryId($relationAlias = null) Adds a INNER JOIN clause to the query using the CartRelatedByAddressDeliveryId relation
|
||||
@@ -83,9 +87,9 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddress matching the query, or a new ChildAddress object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAddress findOneById(int $id) Return the first ChildAddress filtered by the id column
|
||||
* @method ChildAddress findOneByTitle(string $title) Return the first ChildAddress filtered by the title column
|
||||
* @method ChildAddress findOneByName(string $name) Return the first ChildAddress filtered by the name column
|
||||
* @method ChildAddress findOneByCustomerId(int $customer_id) Return the first ChildAddress filtered by the customer_id column
|
||||
* @method ChildAddress findOneByCustomerTitleId(int $customer_title_id) Return the first ChildAddress filtered by the customer_title_id column
|
||||
* @method ChildAddress findOneByTitleId(int $title_id) Return the first ChildAddress filtered by the title_id column
|
||||
* @method ChildAddress findOneByCompany(string $company) Return the first ChildAddress filtered by the company column
|
||||
* @method ChildAddress findOneByFirstname(string $firstname) Return the first ChildAddress filtered by the firstname column
|
||||
* @method ChildAddress findOneByLastname(string $lastname) Return the first ChildAddress filtered by the lastname column
|
||||
@@ -102,9 +106,9 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddress findOneByUpdatedAt(string $updated_at) Return the first ChildAddress filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAddress objects filtered by the id column
|
||||
* @method array findByTitle(string $title) Return ChildAddress objects filtered by the title column
|
||||
* @method array findByName(string $name) Return ChildAddress objects filtered by the name column
|
||||
* @method array findByCustomerId(int $customer_id) Return ChildAddress objects filtered by the customer_id column
|
||||
* @method array findByCustomerTitleId(int $customer_title_id) Return ChildAddress objects filtered by the customer_title_id column
|
||||
* @method array findByTitleId(int $title_id) Return ChildAddress objects filtered by the title_id column
|
||||
* @method array findByCompany(string $company) Return ChildAddress objects filtered by the company column
|
||||
* @method array findByFirstname(string $firstname) Return ChildAddress objects filtered by the firstname column
|
||||
* @method array findByLastname(string $lastname) Return ChildAddress objects filtered by the lastname column
|
||||
@@ -207,7 +211,7 @@ abstract class AddressQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TITLE, CUSTOMER_ID, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, NAME, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -338,32 +342,32 @@ abstract class AddressQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the title column
|
||||
* Filter the query on the name column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
|
||||
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
|
||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $title The value to use as filter.
|
||||
* @param string $name The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTitle($title = null, $comparison = null)
|
||||
public function filterByName($name = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($title)) {
|
||||
if (is_array($name)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $title)) {
|
||||
$title = str_replace('*', '%', $title);
|
||||
} elseif (preg_match('/[\%\*]/', $name)) {
|
||||
$name = str_replace('*', '%', $name);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressTableMap::TITLE, $title, $comparison);
|
||||
return $this->addUsingAlias(AddressTableMap::NAME, $name, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,18 +414,18 @@ abstract class AddressQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the customer_title_id column
|
||||
* Filter the query on the title_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
|
||||
* $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
|
||||
* $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
|
||||
* $query->filterByTitleId(1234); // WHERE title_id = 1234
|
||||
* $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34)
|
||||
* $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCustomerTitle()
|
||||
*
|
||||
* @param mixed $customerTitleId The value to use as filter.
|
||||
* @param mixed $titleId 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.
|
||||
@@ -429,16 +433,16 @@ abstract class AddressQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
|
||||
public function filterByTitleId($titleId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($customerTitleId)) {
|
||||
if (is_array($titleId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($customerTitleId['min'])) {
|
||||
$this->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
|
||||
if (isset($titleId['min'])) {
|
||||
$this->addUsingAlias(AddressTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($customerTitleId['max'])) {
|
||||
$this->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
|
||||
if (isset($titleId['max'])) {
|
||||
$this->addUsingAlias(AddressTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
@@ -449,7 +453,7 @@ abstract class AddressQuery extends ModelCriteria
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
|
||||
return $this->addUsingAlias(AddressTableMap::TITLE_ID, $titleId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -694,6 +698,8 @@ abstract class AddressQuery extends ModelCriteria
|
||||
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCountry()
|
||||
*
|
||||
* @param mixed $countryId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -997,14 +1003,14 @@ abstract class AddressQuery extends ModelCriteria
|
||||
{
|
||||
if ($customerTitle instanceof \Thelia\Model\CustomerTitle) {
|
||||
return $this
|
||||
->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
|
||||
->addUsingAlias(AddressTableMap::TITLE_ID, $customerTitle->getId(), $comparison);
|
||||
} elseif ($customerTitle instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
->addUsingAlias(AddressTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCustomerTitle() only accepts arguments of type \Thelia\Model\CustomerTitle or Collection');
|
||||
}
|
||||
@@ -1018,7 +1024,7 @@ abstract class AddressQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CustomerTitle');
|
||||
@@ -1053,13 +1059,88 @@ abstract class AddressQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCustomerTitle($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Country object
|
||||
*
|
||||
* @param \Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountry($country, $comparison = null)
|
||||
{
|
||||
if ($country instanceof \Thelia\Model\Country) {
|
||||
return $this
|
||||
->addUsingAlias(AddressTableMap::COUNTRY_ID, $country->getId(), $comparison);
|
||||
} elseif ($country instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AddressTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCountry() only accepts arguments of type \Thelia\Model\Country or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Country');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Country');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Country relation Country object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Cart object
|
||||
*
|
||||
|
||||
@@ -17,6 +17,8 @@ use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Address as ChildAddress;
|
||||
use Thelia\Model\AddressQuery as ChildAddressQuery;
|
||||
use Thelia\Model\Area as ChildArea;
|
||||
use Thelia\Model\AreaQuery as ChildAreaQuery;
|
||||
use Thelia\Model\Country as ChildCountry;
|
||||
@@ -114,6 +116,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
protected $collTaxRuleCountries;
|
||||
protected $collTaxRuleCountriesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildAddress[] Collection to store aggregation of ChildAddress objects.
|
||||
*/
|
||||
protected $collAddresses;
|
||||
protected $collAddressesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCountryI18n[] Collection to store aggregation of ChildCountryI18n objects.
|
||||
*/
|
||||
@@ -148,6 +156,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
*/
|
||||
protected $taxRuleCountriesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $addressesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -792,6 +806,8 @@ abstract class Country implements ActiveRecordInterface
|
||||
$this->aArea = null;
|
||||
$this->collTaxRuleCountries = null;
|
||||
|
||||
$this->collAddresses = null;
|
||||
|
||||
$this->collCountryI18ns = null;
|
||||
|
||||
} // if (deep)
|
||||
@@ -956,6 +972,23 @@ abstract class Country implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->addressesScheduledForDeletion !== null) {
|
||||
if (!$this->addressesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AddressQuery::create()
|
||||
->filterByPrimaryKeys($this->addressesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->addressesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAddresses !== null) {
|
||||
foreach ($this->collAddresses as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->countryI18nsScheduledForDeletion !== null) {
|
||||
if (!$this->countryI18nsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CountryI18nQuery::create()
|
||||
@@ -1174,6 +1207,9 @@ abstract class Country implements ActiveRecordInterface
|
||||
if (null !== $this->collTaxRuleCountries) {
|
||||
$result['TaxRuleCountries'] = $this->collTaxRuleCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collAddresses) {
|
||||
$result['Addresses'] = $this->collAddresses->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collCountryI18ns) {
|
||||
$result['CountryI18ns'] = $this->collCountryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
@@ -1363,6 +1399,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getAddresses() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addAddress($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCountryI18ns() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCountryI18n($relObj->copy($deepCopy));
|
||||
@@ -1463,6 +1505,9 @@ abstract class Country implements ActiveRecordInterface
|
||||
if ('TaxRuleCountry' == $relationName) {
|
||||
return $this->initTaxRuleCountries();
|
||||
}
|
||||
if ('Address' == $relationName) {
|
||||
return $this->initAddresses();
|
||||
}
|
||||
if ('CountryI18n' == $relationName) {
|
||||
return $this->initCountryI18ns();
|
||||
}
|
||||
@@ -1736,6 +1781,274 @@ abstract class Country implements ActiveRecordInterface
|
||||
return $this->getTaxRuleCountries($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAddresses collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addAddresses()
|
||||
*/
|
||||
public function clearAddresses()
|
||||
{
|
||||
$this->collAddresses = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collAddresses collection loaded partially.
|
||||
*/
|
||||
public function resetPartialAddresses($v = true)
|
||||
{
|
||||
$this->collAddressesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAddresses collection.
|
||||
*
|
||||
* By default this just sets the collAddresses collection to an empty array (like clearcollAddresses());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||
* the collection even if it is not empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAddresses($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAddresses && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAddresses = new ObjectCollection();
|
||||
$this->collAddresses->setModel('\Thelia\Model\Address');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildAddress objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCountry is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildAddress[] List of ChildAddress objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAddresses($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAddressesPartial && !$this->isNew();
|
||||
if (null === $this->collAddresses || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAddresses) {
|
||||
// return empty collection
|
||||
$this->initAddresses();
|
||||
} else {
|
||||
$collAddresses = ChildAddressQuery::create(null, $criteria)
|
||||
->filterByCountry($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAddressesPartial && count($collAddresses)) {
|
||||
$this->initAddresses(false);
|
||||
|
||||
foreach ($collAddresses as $obj) {
|
||||
if (false == $this->collAddresses->contains($obj)) {
|
||||
$this->collAddresses->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAddressesPartial = true;
|
||||
}
|
||||
|
||||
$collAddresses->getInternalIterator()->rewind();
|
||||
|
||||
return $collAddresses;
|
||||
}
|
||||
|
||||
if ($partial && $this->collAddresses) {
|
||||
foreach ($this->collAddresses as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collAddresses[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAddresses = $collAddresses;
|
||||
$this->collAddressesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAddresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Address objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $addresses A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCountry The current object (for fluent API support)
|
||||
*/
|
||||
public function setAddresses(Collection $addresses, ConnectionInterface $con = null)
|
||||
{
|
||||
$addressesToDelete = $this->getAddresses(new Criteria(), $con)->diff($addresses);
|
||||
|
||||
|
||||
$this->addressesScheduledForDeletion = $addressesToDelete;
|
||||
|
||||
foreach ($addressesToDelete as $addressRemoved) {
|
||||
$addressRemoved->setCountry(null);
|
||||
}
|
||||
|
||||
$this->collAddresses = null;
|
||||
foreach ($addresses as $address) {
|
||||
$this->addAddress($address);
|
||||
}
|
||||
|
||||
$this->collAddresses = $addresses;
|
||||
$this->collAddressesPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related Address objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related Address objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAddresses(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAddressesPartial && !$this->isNew();
|
||||
if (null === $this->collAddresses || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAddresses) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getAddresses());
|
||||
}
|
||||
|
||||
$query = ChildAddressQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCountry($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collAddresses);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildAddress object to this object
|
||||
* through the ChildAddress foreign key attribute.
|
||||
*
|
||||
* @param ChildAddress $l ChildAddress
|
||||
* @return \Thelia\Model\Country The current object (for fluent API support)
|
||||
*/
|
||||
public function addAddress(ChildAddress $l)
|
||||
{
|
||||
if ($this->collAddresses === null) {
|
||||
$this->initAddresses();
|
||||
$this->collAddressesPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collAddresses->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAddress($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address $address The address object to add.
|
||||
*/
|
||||
protected function doAddAddress($address)
|
||||
{
|
||||
$this->collAddresses[]= $address;
|
||||
$address->setCountry($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address $address The address object to remove.
|
||||
* @return ChildCountry The current object (for fluent API support)
|
||||
*/
|
||||
public function removeAddress($address)
|
||||
{
|
||||
if ($this->getAddresses()->contains($address)) {
|
||||
$this->collAddresses->remove($this->collAddresses->search($address));
|
||||
if (null === $this->addressesScheduledForDeletion) {
|
||||
$this->addressesScheduledForDeletion = clone $this->collAddresses;
|
||||
$this->addressesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->addressesScheduledForDeletion[]= clone $address;
|
||||
$address->setCountry(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Country is new, it will return
|
||||
* an empty collection; or if this Country has previously
|
||||
* been saved, it will retrieve related Addresses from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Country.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAddress[] List of ChildAddress objects
|
||||
*/
|
||||
public function getAddressesJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAddressQuery::create(null, $criteria);
|
||||
$query->joinWith('Customer', $joinBehavior);
|
||||
|
||||
return $this->getAddresses($query, $con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Country is new, it will return
|
||||
* an empty collection; or if this Country has previously
|
||||
* been saved, it will retrieve related Addresses from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Country.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAddress[] List of ChildAddress objects
|
||||
*/
|
||||
public function getAddressesJoinCustomerTitle($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAddressQuery::create(null, $criteria);
|
||||
$query->joinWith('CustomerTitle', $joinBehavior);
|
||||
|
||||
return $this->getAddresses($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCountryI18ns collection
|
||||
*
|
||||
@@ -1997,6 +2310,11 @@ abstract class Country implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collAddresses) {
|
||||
foreach ($this->collAddresses as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCountryI18ns) {
|
||||
foreach ($this->collCountryI18ns as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
@@ -2012,6 +2330,10 @@ abstract class Country implements ActiveRecordInterface
|
||||
$this->collTaxRuleCountries->clearIterator();
|
||||
}
|
||||
$this->collTaxRuleCountries = null;
|
||||
if ($this->collAddresses instanceof Collection) {
|
||||
$this->collAddresses->clearIterator();
|
||||
}
|
||||
$this->collAddresses = null;
|
||||
if ($this->collCountryI18ns instanceof Collection) {
|
||||
$this->collCountryI18ns->clearIterator();
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ use Thelia\Model\Map\CountryTableMap;
|
||||
* @method ChildCountryQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
|
||||
* @method ChildCountryQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
|
||||
*
|
||||
* @method ChildCountryQuery leftJoinAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the Address relation
|
||||
* @method ChildCountryQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
|
||||
* @method ChildCountryQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
|
||||
*
|
||||
* @method ChildCountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
|
||||
* @method ChildCountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
|
||||
* @method ChildCountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
|
||||
@@ -654,6 +658,79 @@ abstract class CountryQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Address object
|
||||
*
|
||||
* @param \Thelia\Model\Address|ObjectCollection $address the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAddress($address, $comparison = null)
|
||||
{
|
||||
if ($address instanceof \Thelia\Model\Address) {
|
||||
return $this
|
||||
->addUsingAlias(CountryTableMap::ID, $address->getCountryId(), $comparison);
|
||||
} elseif ($address instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useAddressQuery()
|
||||
->filterByPrimaryKeys($address->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAddress() only accepts arguments of type \Thelia\Model\Address or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Address relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Address');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Address');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Address relation Address object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AddressQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAddress($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CountryI18n object
|
||||
*
|
||||
|
||||
@@ -2153,6 +2153,31 @@ abstract class Customer implements ActiveRecordInterface
|
||||
return $this->getAddresses($query, $con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Customer is new, it will return
|
||||
* an empty collection; or if this Customer has previously
|
||||
* been saved, it will retrieve related Addresses from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Customer.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAddress[] List of ChildAddress objects
|
||||
*/
|
||||
public function getAddressesJoinCountry($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAddressQuery::create(null, $criteria);
|
||||
$query->joinWith('Country', $joinBehavior);
|
||||
|
||||
return $this->getAddresses($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collOrders collection
|
||||
*
|
||||
|
||||
@@ -883,10 +883,9 @@ abstract class CustomerTitle implements ActiveRecordInterface
|
||||
|
||||
if ($this->addressesScheduledForDeletion !== null) {
|
||||
if (!$this->addressesScheduledForDeletion->isEmpty()) {
|
||||
foreach ($this->addressesScheduledForDeletion as $address) {
|
||||
// need to save related object because we set the relation to null
|
||||
$address->save($con);
|
||||
}
|
||||
\Thelia\Model\AddressQuery::create()
|
||||
->filterByPrimaryKeys($this->addressesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->addressesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
@@ -1777,7 +1776,7 @@ abstract class CustomerTitle implements ActiveRecordInterface
|
||||
$this->addressesScheduledForDeletion = clone $this->collAddresses;
|
||||
$this->addressesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->addressesScheduledForDeletion[]= $address;
|
||||
$this->addressesScheduledForDeletion[]= clone $address;
|
||||
$address->setCustomerTitle(null);
|
||||
}
|
||||
|
||||
@@ -1809,6 +1808,31 @@ abstract class CustomerTitle implements ActiveRecordInterface
|
||||
return $this->getAddresses($query, $con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this CustomerTitle is new, it will return
|
||||
* an empty collection; or if this CustomerTitle has previously
|
||||
* been saved, it will retrieve related Addresses from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in CustomerTitle.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAddress[] List of ChildAddress objects
|
||||
*/
|
||||
public function getAddressesJoinCountry($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAddressQuery::create(null, $criteria);
|
||||
$query->joinWith('Country', $joinBehavior);
|
||||
|
||||
return $this->getAddresses($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCustomerTitleI18ns collection
|
||||
*
|
||||
|
||||
@@ -523,7 +523,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
|
||||
{
|
||||
if ($address instanceof \Thelia\Model\Address) {
|
||||
return $this
|
||||
->addUsingAlias(CustomerTitleTableMap::ID, $address->getCustomerTitleId(), $comparison);
|
||||
->addUsingAlias(CustomerTitleTableMap::ID, $address->getTitleId(), $comparison);
|
||||
} elseif ($address instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useAddressQuery()
|
||||
@@ -542,7 +542,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildCustomerTitleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAddress($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
public function joinAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Address');
|
||||
@@ -577,7 +577,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\AddressQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAddressQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
public function useAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAddress($relationAlias, $joinType)
|
||||
|
||||
Reference in New Issue
Block a user