new model

This commit is contained in:
Etienne Roudeix
2013-10-21 08:10:55 +02:00
parent dc2de702e8
commit 0300470f7d
55 changed files with 1753 additions and 16727 deletions

View File

@@ -18,11 +18,11 @@ use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Admin as ChildAdmin;
use Thelia\Model\AdminGroup as ChildAdminGroup;
use Thelia\Model\AdminGroupQuery as ChildAdminGroupQuery;
use Thelia\Model\AdminProfile as ChildAdminProfile;
use Thelia\Model\AdminProfileQuery as ChildAdminProfileQuery;
use Thelia\Model\AdminQuery as ChildAdminQuery;
use Thelia\Model\Group as ChildGroup;
use Thelia\Model\GroupQuery as ChildGroupQuery;
use Thelia\Model\Profile as ChildProfile;
use Thelia\Model\ProfileQuery as ChildProfileQuery;
use Thelia\Model\Map\AdminTableMap;
abstract class Admin implements ActiveRecordInterface
@@ -126,15 +126,15 @@ abstract class Admin implements ActiveRecordInterface
protected $updated_at;
/**
* @var ObjectCollection|ChildAdminGroup[] Collection to store aggregation of ChildAdminGroup objects.
* @var ObjectCollection|ChildAdminProfile[] Collection to store aggregation of ChildAdminProfile objects.
*/
protected $collAdminGroups;
protected $collAdminGroupsPartial;
protected $collAdminProfiles;
protected $collAdminProfilesPartial;
/**
* @var ChildGroup[] Collection to store aggregation of ChildGroup objects.
* @var ChildProfile[] Collection to store aggregation of ChildProfile objects.
*/
protected $collGroups;
protected $collProfiles;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -148,13 +148,13 @@ abstract class Admin implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $groupsScheduledForDeletion = null;
protected $profilesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $adminGroupsScheduledForDeletion = null;
protected $adminProfilesScheduledForDeletion = null;
/**
* Initializes internal state of Thelia\Model\Base\Admin object.
@@ -928,9 +928,9 @@ abstract class Admin implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects?
$this->collAdminGroups = null;
$this->collAdminProfiles = null;
$this->collGroups = null;
$this->collProfiles = null;
} // if (deep)
}
@@ -1064,44 +1064,44 @@ abstract class Admin implements ActiveRecordInterface
$this->resetModified();
}
if ($this->groupsScheduledForDeletion !== null) {
if (!$this->groupsScheduledForDeletion->isEmpty()) {
if ($this->profilesScheduledForDeletion !== null) {
if (!$this->profilesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->groupsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
foreach ($this->profilesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
AdminGroupQuery::create()
AdminProfileQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->groupsScheduledForDeletion = null;
$this->profilesScheduledForDeletion = null;
}
foreach ($this->getGroups() as $group) {
if ($group->isModified()) {
$group->save($con);
foreach ($this->getProfiles() as $profile) {
if ($profile->isModified()) {
$profile->save($con);
}
}
} elseif ($this->collGroups) {
foreach ($this->collGroups as $group) {
if ($group->isModified()) {
$group->save($con);
} elseif ($this->collProfiles) {
foreach ($this->collProfiles as $profile) {
if ($profile->isModified()) {
$profile->save($con);
}
}
}
if ($this->adminGroupsScheduledForDeletion !== null) {
if (!$this->adminGroupsScheduledForDeletion->isEmpty()) {
\Thelia\Model\AdminGroupQuery::create()
->filterByPrimaryKeys($this->adminGroupsScheduledForDeletion->getPrimaryKeys(false))
if ($this->adminProfilesScheduledForDeletion !== null) {
if (!$this->adminProfilesScheduledForDeletion->isEmpty()) {
\Thelia\Model\AdminProfileQuery::create()
->filterByPrimaryKeys($this->adminProfilesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->adminGroupsScheduledForDeletion = null;
$this->adminProfilesScheduledForDeletion = null;
}
}
if ($this->collAdminGroups !== null) {
foreach ($this->collAdminGroups as $referrerFK) {
if ($this->collAdminProfiles !== null) {
foreach ($this->collAdminProfiles as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1353,8 +1353,8 @@ abstract class Admin implements ActiveRecordInterface
}
if ($includeForeignObjects) {
if (null !== $this->collAdminGroups) {
$result['AdminGroups'] = $this->collAdminGroups->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
if (null !== $this->collAdminProfiles) {
$result['AdminProfiles'] = $this->collAdminProfiles->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -1559,9 +1559,9 @@ abstract class Admin implements ActiveRecordInterface
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
foreach ($this->getAdminGroups() as $relObj) {
foreach ($this->getAdminProfiles() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addAdminGroup($relObj->copy($deepCopy));
$copyObj->addAdminProfile($relObj->copy($deepCopy));
}
}
@@ -1606,37 +1606,37 @@ abstract class Admin implements ActiveRecordInterface
*/
public function initRelation($relationName)
{
if ('AdminGroup' == $relationName) {
return $this->initAdminGroups();
if ('AdminProfile' == $relationName) {
return $this->initAdminProfiles();
}
}
/**
* Clears out the collAdminGroups collection
* Clears out the collAdminProfiles 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 addAdminGroups()
* @see addAdminProfiles()
*/
public function clearAdminGroups()
public function clearAdminProfiles()
{
$this->collAdminGroups = null; // important to set this to NULL since that means it is uninitialized
$this->collAdminProfiles = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collAdminGroups collection loaded partially.
* Reset is the collAdminProfiles collection loaded partially.
*/
public function resetPartialAdminGroups($v = true)
public function resetPartialAdminProfiles($v = true)
{
$this->collAdminGroupsPartial = $v;
$this->collAdminProfilesPartial = $v;
}
/**
* Initializes the collAdminGroups collection.
* Initializes the collAdminProfiles collection.
*
* By default this just sets the collAdminGroups collection to an empty array (like clearcollAdminGroups());
* By default this just sets the collAdminProfiles collection to an empty array (like clearcollAdminProfiles());
* 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.
*
@@ -1645,17 +1645,17 @@ abstract class Admin implements ActiveRecordInterface
*
* @return void
*/
public function initAdminGroups($overrideExisting = true)
public function initAdminProfiles($overrideExisting = true)
{
if (null !== $this->collAdminGroups && !$overrideExisting) {
if (null !== $this->collAdminProfiles && !$overrideExisting) {
return;
}
$this->collAdminGroups = new ObjectCollection();
$this->collAdminGroups->setModel('\Thelia\Model\AdminGroup');
$this->collAdminProfiles = new ObjectCollection();
$this->collAdminProfiles->setModel('\Thelia\Model\AdminProfile');
}
/**
* Gets an array of ChildAdminGroup objects which contain a foreign key that references this object.
* Gets an array of ChildAdminProfile 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.
@@ -1665,112 +1665,112 @@ abstract class Admin implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildAdminGroup[] List of ChildAdminGroup objects
* @return Collection|ChildAdminProfile[] List of ChildAdminProfile objects
* @throws PropelException
*/
public function getAdminGroups($criteria = null, ConnectionInterface $con = null)
public function getAdminProfiles($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collAdminGroupsPartial && !$this->isNew();
if (null === $this->collAdminGroups || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAdminGroups) {
$partial = $this->collAdminProfilesPartial && !$this->isNew();
if (null === $this->collAdminProfiles || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAdminProfiles) {
// return empty collection
$this->initAdminGroups();
$this->initAdminProfiles();
} else {
$collAdminGroups = ChildAdminGroupQuery::create(null, $criteria)
$collAdminProfiles = ChildAdminProfileQuery::create(null, $criteria)
->filterByAdmin($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collAdminGroupsPartial && count($collAdminGroups)) {
$this->initAdminGroups(false);
if (false !== $this->collAdminProfilesPartial && count($collAdminProfiles)) {
$this->initAdminProfiles(false);
foreach ($collAdminGroups as $obj) {
if (false == $this->collAdminGroups->contains($obj)) {
$this->collAdminGroups->append($obj);
foreach ($collAdminProfiles as $obj) {
if (false == $this->collAdminProfiles->contains($obj)) {
$this->collAdminProfiles->append($obj);
}
}
$this->collAdminGroupsPartial = true;
$this->collAdminProfilesPartial = true;
}
$collAdminGroups->getInternalIterator()->rewind();
$collAdminProfiles->getInternalIterator()->rewind();
return $collAdminGroups;
return $collAdminProfiles;
}
if ($partial && $this->collAdminGroups) {
foreach ($this->collAdminGroups as $obj) {
if ($partial && $this->collAdminProfiles) {
foreach ($this->collAdminProfiles as $obj) {
if ($obj->isNew()) {
$collAdminGroups[] = $obj;
$collAdminProfiles[] = $obj;
}
}
}
$this->collAdminGroups = $collAdminGroups;
$this->collAdminGroupsPartial = false;
$this->collAdminProfiles = $collAdminProfiles;
$this->collAdminProfilesPartial = false;
}
}
return $this->collAdminGroups;
return $this->collAdminProfiles;
}
/**
* Sets a collection of AdminGroup objects related by a one-to-many relationship
* Sets a collection of AdminProfile 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 $adminGroups A Propel collection.
* @param Collection $adminProfiles A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildAdmin The current object (for fluent API support)
*/
public function setAdminGroups(Collection $adminGroups, ConnectionInterface $con = null)
public function setAdminProfiles(Collection $adminProfiles, ConnectionInterface $con = null)
{
$adminGroupsToDelete = $this->getAdminGroups(new Criteria(), $con)->diff($adminGroups);
$adminProfilesToDelete = $this->getAdminProfiles(new Criteria(), $con)->diff($adminProfiles);
//since at least one column in the foreign key is at the same time a PK
//we can not just set a PK to NULL in the lines below. We have to store
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
$this->adminGroupsScheduledForDeletion = clone $adminGroupsToDelete;
$this->adminProfilesScheduledForDeletion = clone $adminProfilesToDelete;
foreach ($adminGroupsToDelete as $adminGroupRemoved) {
$adminGroupRemoved->setAdmin(null);
foreach ($adminProfilesToDelete as $adminProfileRemoved) {
$adminProfileRemoved->setAdmin(null);
}
$this->collAdminGroups = null;
foreach ($adminGroups as $adminGroup) {
$this->addAdminGroup($adminGroup);
$this->collAdminProfiles = null;
foreach ($adminProfiles as $adminProfile) {
$this->addAdminProfile($adminProfile);
}
$this->collAdminGroups = $adminGroups;
$this->collAdminGroupsPartial = false;
$this->collAdminProfiles = $adminProfiles;
$this->collAdminProfilesPartial = false;
return $this;
}
/**
* Returns the number of related AdminGroup objects.
* Returns the number of related AdminProfile objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related AdminGroup objects.
* @return int Count of related AdminProfile objects.
* @throws PropelException
*/
public function countAdminGroups(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countAdminProfiles(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collAdminGroupsPartial && !$this->isNew();
if (null === $this->collAdminGroups || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAdminGroups) {
$partial = $this->collAdminProfilesPartial && !$this->isNew();
if (null === $this->collAdminProfiles || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAdminProfiles) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getAdminGroups());
return count($this->getAdminProfiles());
}
$query = ChildAdminGroupQuery::create(null, $criteria);
$query = ChildAdminProfileQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1780,53 +1780,53 @@ abstract class Admin implements ActiveRecordInterface
->count($con);
}
return count($this->collAdminGroups);
return count($this->collAdminProfiles);
}
/**
* Method called to associate a ChildAdminGroup object to this object
* through the ChildAdminGroup foreign key attribute.
* Method called to associate a ChildAdminProfile object to this object
* through the ChildAdminProfile foreign key attribute.
*
* @param ChildAdminGroup $l ChildAdminGroup
* @param ChildAdminProfile $l ChildAdminProfile
* @return \Thelia\Model\Admin The current object (for fluent API support)
*/
public function addAdminGroup(ChildAdminGroup $l)
public function addAdminProfile(ChildAdminProfile $l)
{
if ($this->collAdminGroups === null) {
$this->initAdminGroups();
$this->collAdminGroupsPartial = true;
if ($this->collAdminProfiles === null) {
$this->initAdminProfiles();
$this->collAdminProfilesPartial = true;
}
if (!in_array($l, $this->collAdminGroups->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddAdminGroup($l);
if (!in_array($l, $this->collAdminProfiles->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddAdminProfile($l);
}
return $this;
}
/**
* @param AdminGroup $adminGroup The adminGroup object to add.
* @param AdminProfile $adminProfile The adminProfile object to add.
*/
protected function doAddAdminGroup($adminGroup)
protected function doAddAdminProfile($adminProfile)
{
$this->collAdminGroups[]= $adminGroup;
$adminGroup->setAdmin($this);
$this->collAdminProfiles[]= $adminProfile;
$adminProfile->setAdmin($this);
}
/**
* @param AdminGroup $adminGroup The adminGroup object to remove.
* @param AdminProfile $adminProfile The adminProfile object to remove.
* @return ChildAdmin The current object (for fluent API support)
*/
public function removeAdminGroup($adminGroup)
public function removeAdminProfile($adminProfile)
{
if ($this->getAdminGroups()->contains($adminGroup)) {
$this->collAdminGroups->remove($this->collAdminGroups->search($adminGroup));
if (null === $this->adminGroupsScheduledForDeletion) {
$this->adminGroupsScheduledForDeletion = clone $this->collAdminGroups;
$this->adminGroupsScheduledForDeletion->clear();
if ($this->getAdminProfiles()->contains($adminProfile)) {
$this->collAdminProfiles->remove($this->collAdminProfiles->search($adminProfile));
if (null === $this->adminProfilesScheduledForDeletion) {
$this->adminProfilesScheduledForDeletion = clone $this->collAdminProfiles;
$this->adminProfilesScheduledForDeletion->clear();
}
$this->adminGroupsScheduledForDeletion[]= clone $adminGroup;
$adminGroup->setAdmin(null);
$this->adminProfilesScheduledForDeletion[]= clone $adminProfile;
$adminProfile->setAdmin(null);
}
return $this;
@@ -1838,7 +1838,7 @@ abstract class Admin implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Admin is new, it will return
* an empty collection; or if this Admin has previously
* been saved, it will retrieve related AdminGroups from storage.
* been saved, it will retrieve related AdminProfiles from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -1847,49 +1847,49 @@ abstract class Admin implements ActiveRecordInterface
* @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|ChildAdminGroup[] List of ChildAdminGroup objects
* @return Collection|ChildAdminProfile[] List of ChildAdminProfile objects
*/
public function getAdminGroupsJoinGroup($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
public function getAdminProfilesJoinProfile($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildAdminGroupQuery::create(null, $criteria);
$query->joinWith('Group', $joinBehavior);
$query = ChildAdminProfileQuery::create(null, $criteria);
$query->joinWith('Profile', $joinBehavior);
return $this->getAdminGroups($query, $con);
return $this->getAdminProfiles($query, $con);
}
/**
* Clears out the collGroups collection
* Clears out the collProfiles 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 addGroups()
* @see addProfiles()
*/
public function clearGroups()
public function clearProfiles()
{
$this->collGroups = null; // important to set this to NULL since that means it is uninitialized
$this->collGroupsPartial = null;
$this->collProfiles = null; // important to set this to NULL since that means it is uninitialized
$this->collProfilesPartial = null;
}
/**
* Initializes the collGroups collection.
* Initializes the collProfiles collection.
*
* By default this just sets the collGroups collection to an empty collection (like clearGroups());
* By default this just sets the collProfiles collection to an empty collection (like clearProfiles());
* 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.
*
* @return void
*/
public function initGroups()
public function initProfiles()
{
$this->collGroups = new ObjectCollection();
$this->collGroups->setModel('\Thelia\Model\Group');
$this->collProfiles = new ObjectCollection();
$this->collProfiles->setModel('\Thelia\Model\Profile');
}
/**
* Gets a collection of ChildGroup objects related by a many-to-many relationship
* to the current object by way of the admin_group cross-reference table.
* Gets a collection of ChildProfile objects related by a many-to-many relationship
* to the current object by way of the admin_profile cross-reference table.
*
* 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.
@@ -1900,73 +1900,73 @@ abstract class Admin implements ActiveRecordInterface
* @param Criteria $criteria Optional query object to filter the query
* @param ConnectionInterface $con Optional connection object
*
* @return ObjectCollection|ChildGroup[] List of ChildGroup objects
* @return ObjectCollection|ChildProfile[] List of ChildProfile objects
*/
public function getGroups($criteria = null, ConnectionInterface $con = null)
public function getProfiles($criteria = null, ConnectionInterface $con = null)
{
if (null === $this->collGroups || null !== $criteria) {
if ($this->isNew() && null === $this->collGroups) {
if (null === $this->collProfiles || null !== $criteria) {
if ($this->isNew() && null === $this->collProfiles) {
// return empty collection
$this->initGroups();
$this->initProfiles();
} else {
$collGroups = ChildGroupQuery::create(null, $criteria)
$collProfiles = ChildProfileQuery::create(null, $criteria)
->filterByAdmin($this)
->find($con);
if (null !== $criteria) {
return $collGroups;
return $collProfiles;
}
$this->collGroups = $collGroups;
$this->collProfiles = $collProfiles;
}
}
return $this->collGroups;
return $this->collProfiles;
}
/**
* Sets a collection of Group objects related by a many-to-many relationship
* to the current object by way of the admin_group cross-reference table.
* Sets a collection of Profile objects related by a many-to-many relationship
* to the current object by way of the admin_profile cross-reference table.
* 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 $groups A Propel collection.
* @param Collection $profiles A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildAdmin The current object (for fluent API support)
*/
public function setGroups(Collection $groups, ConnectionInterface $con = null)
public function setProfiles(Collection $profiles, ConnectionInterface $con = null)
{
$this->clearGroups();
$currentGroups = $this->getGroups();
$this->clearProfiles();
$currentProfiles = $this->getProfiles();
$this->groupsScheduledForDeletion = $currentGroups->diff($groups);
$this->profilesScheduledForDeletion = $currentProfiles->diff($profiles);
foreach ($groups as $group) {
if (!$currentGroups->contains($group)) {
$this->doAddGroup($group);
foreach ($profiles as $profile) {
if (!$currentProfiles->contains($profile)) {
$this->doAddProfile($profile);
}
}
$this->collGroups = $groups;
$this->collProfiles = $profiles;
return $this;
}
/**
* Gets the number of ChildGroup objects related by a many-to-many relationship
* to the current object by way of the admin_group cross-reference table.
* Gets the number of ChildProfile objects related by a many-to-many relationship
* to the current object by way of the admin_profile cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param ConnectionInterface $con Optional connection object
*
* @return int the number of related ChildGroup objects
* @return int the number of related ChildProfile objects
*/
public function countGroups($criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countProfiles($criteria = null, $distinct = false, ConnectionInterface $con = null)
{
if (null === $this->collGroups || null !== $criteria) {
if ($this->isNew() && null === $this->collGroups) {
if (null === $this->collProfiles || null !== $criteria) {
if ($this->isNew() && null === $this->collProfiles) {
return 0;
} else {
$query = ChildGroupQuery::create(null, $criteria);
$query = ChildProfileQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1976,65 +1976,65 @@ abstract class Admin implements ActiveRecordInterface
->count($con);
}
} else {
return count($this->collGroups);
return count($this->collProfiles);
}
}
/**
* Associate a ChildGroup object to this object
* through the admin_group cross reference table.
* Associate a ChildProfile object to this object
* through the admin_profile cross reference table.
*
* @param ChildGroup $group The ChildAdminGroup object to relate
* @param ChildProfile $profile The ChildAdminProfile object to relate
* @return ChildAdmin The current object (for fluent API support)
*/
public function addGroup(ChildGroup $group)
public function addProfile(ChildProfile $profile)
{
if ($this->collGroups === null) {
$this->initGroups();
if ($this->collProfiles === null) {
$this->initProfiles();
}
if (!$this->collGroups->contains($group)) { // only add it if the **same** object is not already associated
$this->doAddGroup($group);
$this->collGroups[] = $group;
if (!$this->collProfiles->contains($profile)) { // only add it if the **same** object is not already associated
$this->doAddProfile($profile);
$this->collProfiles[] = $profile;
}
return $this;
}
/**
* @param Group $group The group object to add.
* @param Profile $profile The profile object to add.
*/
protected function doAddGroup($group)
protected function doAddProfile($profile)
{
$adminGroup = new ChildAdminGroup();
$adminGroup->setGroup($group);
$this->addAdminGroup($adminGroup);
$adminProfile = new ChildAdminProfile();
$adminProfile->setProfile($profile);
$this->addAdminProfile($adminProfile);
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
if (!$group->getAdmins()->contains($this)) {
$foreignCollection = $group->getAdmins();
if (!$profile->getAdmins()->contains($this)) {
$foreignCollection = $profile->getAdmins();
$foreignCollection[] = $this;
}
}
/**
* Remove a ChildGroup object to this object
* through the admin_group cross reference table.
* Remove a ChildProfile object to this object
* through the admin_profile cross reference table.
*
* @param ChildGroup $group The ChildAdminGroup object to relate
* @param ChildProfile $profile The ChildAdminProfile object to relate
* @return ChildAdmin The current object (for fluent API support)
*/
public function removeGroup(ChildGroup $group)
public function removeProfile(ChildProfile $profile)
{
if ($this->getGroups()->contains($group)) {
$this->collGroups->remove($this->collGroups->search($group));
if ($this->getProfiles()->contains($profile)) {
$this->collProfiles->remove($this->collProfiles->search($profile));
if (null === $this->groupsScheduledForDeletion) {
$this->groupsScheduledForDeletion = clone $this->collGroups;
$this->groupsScheduledForDeletion->clear();
if (null === $this->profilesScheduledForDeletion) {
$this->profilesScheduledForDeletion = clone $this->collProfiles;
$this->profilesScheduledForDeletion->clear();
}
$this->groupsScheduledForDeletion[] = $group;
$this->profilesScheduledForDeletion[] = $profile;
}
return $this;
@@ -2075,26 +2075,26 @@ abstract class Admin implements ActiveRecordInterface
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($this->collAdminGroups) {
foreach ($this->collAdminGroups as $o) {
if ($this->collAdminProfiles) {
foreach ($this->collAdminProfiles as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collGroups) {
foreach ($this->collGroups as $o) {
if ($this->collProfiles) {
foreach ($this->collProfiles as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
if ($this->collAdminGroups instanceof Collection) {
$this->collAdminGroups->clearIterator();
if ($this->collAdminProfiles instanceof Collection) {
$this->collAdminProfiles->clearIterator();
}
$this->collAdminGroups = null;
if ($this->collGroups instanceof Collection) {
$this->collGroups->clearIterator();
$this->collAdminProfiles = null;
if ($this->collProfiles instanceof Collection) {
$this->collProfiles->clearIterator();
}
$this->collGroups = null;
$this->collProfiles = null;
}
/**

File diff suppressed because it is too large Load Diff

View File

@@ -1,778 +0,0 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\AdminGroup as ChildAdminGroup;
use Thelia\Model\AdminGroupQuery as ChildAdminGroupQuery;
use Thelia\Model\Map\AdminGroupTableMap;
/**
* Base class that represents a query for the 'admin_group' table.
*
*
*
* @method ChildAdminGroupQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAdminGroupQuery orderByGroupId($order = Criteria::ASC) Order by the group_id column
* @method ChildAdminGroupQuery orderByAdminId($order = Criteria::ASC) Order by the admin_id column
* @method ChildAdminGroupQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAdminGroupQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildAdminGroupQuery groupById() Group by the id column
* @method ChildAdminGroupQuery groupByGroupId() Group by the group_id column
* @method ChildAdminGroupQuery groupByAdminId() Group by the admin_id column
* @method ChildAdminGroupQuery groupByCreatedAt() Group by the created_at column
* @method ChildAdminGroupQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildAdminGroupQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildAdminGroupQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildAdminGroupQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildAdminGroupQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
* @method ChildAdminGroupQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
* @method ChildAdminGroupQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
*
* @method ChildAdminGroupQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
* @method ChildAdminGroupQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
* @method ChildAdminGroupQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
*
* @method ChildAdminGroup findOne(ConnectionInterface $con = null) Return the first ChildAdminGroup matching the query
* @method ChildAdminGroup findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAdminGroup matching the query, or a new ChildAdminGroup object populated from the query conditions when no match is found
*
* @method ChildAdminGroup findOneById(int $id) Return the first ChildAdminGroup filtered by the id column
* @method ChildAdminGroup findOneByGroupId(int $group_id) Return the first ChildAdminGroup filtered by the group_id column
* @method ChildAdminGroup findOneByAdminId(int $admin_id) Return the first ChildAdminGroup filtered by the admin_id column
* @method ChildAdminGroup findOneByCreatedAt(string $created_at) Return the first ChildAdminGroup filtered by the created_at column
* @method ChildAdminGroup findOneByUpdatedAt(string $updated_at) Return the first ChildAdminGroup filtered by the updated_at column
*
* @method array findById(int $id) Return ChildAdminGroup objects filtered by the id column
* @method array findByGroupId(int $group_id) Return ChildAdminGroup objects filtered by the group_id column
* @method array findByAdminId(int $admin_id) Return ChildAdminGroup objects filtered by the admin_id column
* @method array findByCreatedAt(string $created_at) Return ChildAdminGroup objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAdminGroup objects filtered by the updated_at column
*
*/
abstract class AdminGroupQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\AdminGroupQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AdminGroup', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildAdminGroupQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildAdminGroupQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\AdminGroupQuery) {
return $criteria;
}
$query = new \Thelia\Model\AdminGroupQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34, 56), $con);
* </code>
*
* @param array[$id, $group_id, $admin_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildAdminGroup|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AdminGroupTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(AdminGroupTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildAdminGroup A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, GROUP_ID, ADMIN_ID, CREATED_AT, UPDATED_AT FROM admin_group WHERE ID = :p0 AND GROUP_ID = :p1 AND ADMIN_ID = :p2';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildAdminGroup();
$obj->hydrate($row);
AdminGroupTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildAdminGroup|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(AdminGroupTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(AdminGroupTableMap::GROUP_ID, $key[1], Criteria::EQUAL);
$this->addUsingAlias(AdminGroupTableMap::ADMIN_ID, $key[2], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(AdminGroupTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(AdminGroupTableMap::GROUP_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$cton2 = $this->getNewCriterion(AdminGroupTableMap::ADMIN_ID, $key[2], Criteria::EQUAL);
$cton0->addAnd($cton2);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(AdminGroupTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(AdminGroupTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the group_id column
*
* Example usage:
* <code>
* $query->filterByGroupId(1234); // WHERE group_id = 1234
* $query->filterByGroupId(array(12, 34)); // WHERE group_id IN (12, 34)
* $query->filterByGroupId(array('min' => 12)); // WHERE group_id > 12
* </code>
*
* @see filterByGroup()
*
* @param mixed $groupId 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByGroupId($groupId = null, $comparison = null)
{
if (is_array($groupId)) {
$useMinMax = false;
if (isset($groupId['min'])) {
$this->addUsingAlias(AdminGroupTableMap::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($groupId['max'])) {
$this->addUsingAlias(AdminGroupTableMap::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupTableMap::GROUP_ID, $groupId, $comparison);
}
/**
* Filter the query on the admin_id column
*
* Example usage:
* <code>
* $query->filterByAdminId(1234); // WHERE admin_id = 1234
* $query->filterByAdminId(array(12, 34)); // WHERE admin_id IN (12, 34)
* $query->filterByAdminId(array('min' => 12)); // WHERE admin_id > 12
* </code>
*
* @see filterByAdmin()
*
* @param mixed $adminId 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByAdminId($adminId = null, $comparison = null)
{
if (is_array($adminId)) {
$useMinMax = false;
if (isset($adminId['min'])) {
$this->addUsingAlias(AdminGroupTableMap::ADMIN_ID, $adminId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($adminId['max'])) {
$this->addUsingAlias(AdminGroupTableMap::ADMIN_ID, $adminId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupTableMap::ADMIN_ID, $adminId, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(AdminGroupTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AdminGroupTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(AdminGroupTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AdminGroupTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Group object
*
* @param \Thelia\Model\Group|ObjectCollection $group The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = null)
{
if ($group instanceof \Thelia\Model\Group) {
return $this
->addUsingAlias(AdminGroupTableMap::GROUP_ID, $group->getId(), $comparison);
} elseif ($group instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AdminGroupTableMap::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByGroup() only accepts arguments of type \Thelia\Model\Group or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Group relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Group');
// 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, 'Group');
}
return $this;
}
/**
* Use the Group relation Group 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\GroupQuery A secondary query class using the current class as primary query
*/
public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
}
/**
* Filter the query by a related \Thelia\Model\Admin object
*
* @param \Thelia\Model\Admin|ObjectCollection $admin The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function filterByAdmin($admin, $comparison = null)
{
if ($admin instanceof \Thelia\Model\Admin) {
return $this
->addUsingAlias(AdminGroupTableMap::ADMIN_ID, $admin->getId(), $comparison);
} elseif ($admin instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AdminGroupTableMap::ADMIN_ID, $admin->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAdmin() only accepts arguments of type \Thelia\Model\Admin or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Admin relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function joinAdmin($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Admin');
// 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, 'Admin');
}
return $this;
}
/**
* Use the Admin relation Admin 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\AdminQuery A secondary query class using the current class as primary query
*/
public function useAdminQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAdmin($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
}
/**
* Exclude object from result
*
* @param ChildAdminGroup $adminGroup Object to remove from the list of results
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function prune($adminGroup = null)
{
if ($adminGroup) {
$this->addCond('pruneCond0', $this->getAliasedColName(AdminGroupTableMap::ID), $adminGroup->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(AdminGroupTableMap::GROUP_ID), $adminGroup->getGroupId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond2', $this->getAliasedColName(AdminGroupTableMap::ADMIN_ID), $adminGroup->getAdminId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the admin_group table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(AdminGroupTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
AdminGroupTableMap::clearInstancePool();
AdminGroupTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildAdminGroup or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildAdminGroup object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(AdminGroupTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(AdminGroupTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
AdminGroupTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
AdminGroupTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(AdminGroupTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(AdminGroupTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(AdminGroupTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(AdminGroupTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(AdminGroupTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildAdminGroupQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(AdminGroupTableMap::CREATED_AT);
}
} // AdminGroupQuery

View File

@@ -49,9 +49,9 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdminQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildAdminQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildAdminQuery leftJoinAdminGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminGroup relation
* @method ChildAdminQuery rightJoinAdminGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminGroup relation
* @method ChildAdminQuery innerJoinAdminGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminGroup relation
* @method ChildAdminQuery leftJoinAdminProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminProfile relation
* @method ChildAdminQuery rightJoinAdminProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminProfile relation
* @method ChildAdminQuery innerJoinAdminProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminProfile relation
*
* @method ChildAdmin findOne(ConnectionInterface $con = null) Return the first ChildAdmin matching the query
* @method ChildAdmin findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAdmin matching the query, or a new ChildAdmin object populated from the query conditions when no match is found
@@ -616,40 +616,40 @@ abstract class AdminQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\AdminGroup object
* Filter the query by a related \Thelia\Model\AdminProfile object
*
* @param \Thelia\Model\AdminGroup|ObjectCollection $adminGroup the related object to use as filter
* @param \Thelia\Model\AdminProfile|ObjectCollection $adminProfile the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminQuery The current query, for fluid interface
*/
public function filterByAdminGroup($adminGroup, $comparison = null)
public function filterByAdminProfile($adminProfile, $comparison = null)
{
if ($adminGroup instanceof \Thelia\Model\AdminGroup) {
if ($adminProfile instanceof \Thelia\Model\AdminProfile) {
return $this
->addUsingAlias(AdminTableMap::ID, $adminGroup->getAdminId(), $comparison);
} elseif ($adminGroup instanceof ObjectCollection) {
->addUsingAlias(AdminTableMap::ID, $adminProfile->getAdminId(), $comparison);
} elseif ($adminProfile instanceof ObjectCollection) {
return $this
->useAdminGroupQuery()
->filterByPrimaryKeys($adminGroup->getPrimaryKeys())
->useAdminProfileQuery()
->filterByPrimaryKeys($adminProfile->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAdminGroup() only accepts arguments of type \Thelia\Model\AdminGroup or Collection');
throw new PropelException('filterByAdminProfile() only accepts arguments of type \Thelia\Model\AdminProfile or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AdminGroup relation
* Adds a JOIN clause to the query using the AdminProfile relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAdminQuery The current query, for fluid interface
*/
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinAdminProfile($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AdminGroup');
$relationMap = $tableMap->getRelation('AdminProfile');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -664,14 +664,14 @@ abstract class AdminQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'AdminGroup');
$this->addJoinObject($join, 'AdminProfile');
}
return $this;
}
/**
* Use the AdminGroup relation AdminGroup object
* Use the AdminProfile relation AdminProfile object
*
* @see useQuery()
*
@@ -679,29 +679,29 @@ abstract class AdminQuery extends ModelCriteria
* 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\AdminGroupQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\AdminProfileQuery A secondary query class using the current class as primary query
*/
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useAdminProfileQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAdminGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AdminGroup', '\Thelia\Model\AdminGroupQuery');
->joinAdminProfile($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AdminProfile', '\Thelia\Model\AdminProfileQuery');
}
/**
* Filter the query by a related Group object
* using the admin_group table as cross reference
* Filter the query by a related Profile object
* using the admin_profile table as cross reference
*
* @param Group $group the related object to use as filter
* @param Profile $profile the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAdminQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = Criteria::EQUAL)
public function filterByProfile($profile, $comparison = Criteria::EQUAL)
{
return $this
->useAdminGroupQuery()
->filterByGroup($group, $comparison)
->useAdminProfileQuery()
->filterByProfile($profile, $comparison)
->endUse();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,607 +0,0 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\GroupI18n as ChildGroupI18n;
use Thelia\Model\GroupI18nQuery as ChildGroupI18nQuery;
use Thelia\Model\Map\GroupI18nTableMap;
/**
* Base class that represents a query for the 'group_i18n' table.
*
*
*
* @method ChildGroupI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildGroupI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildGroupI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildGroupI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildGroupI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildGroupI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildGroupI18nQuery groupById() Group by the id column
* @method ChildGroupI18nQuery groupByLocale() Group by the locale column
* @method ChildGroupI18nQuery groupByTitle() Group by the title column
* @method ChildGroupI18nQuery groupByDescription() Group by the description column
* @method ChildGroupI18nQuery groupByChapo() Group by the chapo column
* @method ChildGroupI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildGroupI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildGroupI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildGroupI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildGroupI18nQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
* @method ChildGroupI18nQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
* @method ChildGroupI18nQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
*
* @method ChildGroupI18n findOne(ConnectionInterface $con = null) Return the first ChildGroupI18n matching the query
* @method ChildGroupI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildGroupI18n matching the query, or a new ChildGroupI18n object populated from the query conditions when no match is found
*
* @method ChildGroupI18n findOneById(int $id) Return the first ChildGroupI18n filtered by the id column
* @method ChildGroupI18n findOneByLocale(string $locale) Return the first ChildGroupI18n filtered by the locale column
* @method ChildGroupI18n findOneByTitle(string $title) Return the first ChildGroupI18n filtered by the title column
* @method ChildGroupI18n findOneByDescription(string $description) Return the first ChildGroupI18n filtered by the description column
* @method ChildGroupI18n findOneByChapo(string $chapo) Return the first ChildGroupI18n filtered by the chapo column
* @method ChildGroupI18n findOneByPostscriptum(string $postscriptum) Return the first ChildGroupI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildGroupI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildGroupI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildGroupI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildGroupI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildGroupI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildGroupI18n objects filtered by the postscriptum column
*
*/
abstract class GroupI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\GroupI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\GroupI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildGroupI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildGroupI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\GroupI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\GroupI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $locale] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildGroupI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = GroupI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(GroupI18nTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroupI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM group_i18n WHERE ID = :p0 AND LOCALE = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildGroupI18n();
$obj->hydrate($row);
GroupI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroupI18n|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(GroupI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(GroupI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(GroupI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(GroupI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @see filterByGroup()
*
* @param mixed $id 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(GroupI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(GroupI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupI18nTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale 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 ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(GroupI18nTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title 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 ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(GroupI18nTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description 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 ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(GroupI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(GroupI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum 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 ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(GroupI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Group object
*
* @param \Thelia\Model\Group|ObjectCollection $group The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupI18nQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = null)
{
if ($group instanceof \Thelia\Model\Group) {
return $this
->addUsingAlias(GroupI18nTableMap::ID, $group->getId(), $comparison);
} elseif ($group instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(GroupI18nTableMap::ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByGroup() only accepts arguments of type \Thelia\Model\Group or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Group relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupI18nQuery The current query, for fluid interface
*/
public function joinGroup($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Group');
// 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, 'Group');
}
return $this;
}
/**
* Use the Group relation Group 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\GroupQuery A secondary query class using the current class as primary query
*/
public function useGroupQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
}
/**
* Exclude object from result
*
* @param ChildGroupI18n $groupI18n Object to remove from the list of results
*
* @return ChildGroupI18nQuery The current query, for fluid interface
*/
public function prune($groupI18n = null)
{
if ($groupI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(GroupI18nTableMap::ID), $groupI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(GroupI18nTableMap::LOCALE), $groupI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the group_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupI18nTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
GroupI18nTableMap::clearInstancePool();
GroupI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildGroupI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildGroupI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(GroupI18nTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
GroupI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
GroupI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // GroupI18nQuery

File diff suppressed because it is too large Load Diff

View File

@@ -1,804 +0,0 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\GroupModule as ChildGroupModule;
use Thelia\Model\GroupModuleQuery as ChildGroupModuleQuery;
use Thelia\Model\Map\GroupModuleTableMap;
/**
* Base class that represents a query for the 'group_module' table.
*
*
*
* @method ChildGroupModuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildGroupModuleQuery orderByGroupId($order = Criteria::ASC) Order by the group_id column
* @method ChildGroupModuleQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
* @method ChildGroupModuleQuery orderByAccess($order = Criteria::ASC) Order by the access column
* @method ChildGroupModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildGroupModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildGroupModuleQuery groupById() Group by the id column
* @method ChildGroupModuleQuery groupByGroupId() Group by the group_id column
* @method ChildGroupModuleQuery groupByModuleId() Group by the module_id column
* @method ChildGroupModuleQuery groupByAccess() Group by the access column
* @method ChildGroupModuleQuery groupByCreatedAt() Group by the created_at column
* @method ChildGroupModuleQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildGroupModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildGroupModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildGroupModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildGroupModuleQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
* @method ChildGroupModuleQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
* @method ChildGroupModuleQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
*
* @method ChildGroupModuleQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildGroupModuleQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildGroupModuleQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
*
* @method ChildGroupModule findOne(ConnectionInterface $con = null) Return the first ChildGroupModule matching the query
* @method ChildGroupModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildGroupModule matching the query, or a new ChildGroupModule object populated from the query conditions when no match is found
*
* @method ChildGroupModule findOneById(int $id) Return the first ChildGroupModule filtered by the id column
* @method ChildGroupModule findOneByGroupId(int $group_id) Return the first ChildGroupModule filtered by the group_id column
* @method ChildGroupModule findOneByModuleId(int $module_id) Return the first ChildGroupModule filtered by the module_id column
* @method ChildGroupModule findOneByAccess(int $access) Return the first ChildGroupModule filtered by the access column
* @method ChildGroupModule findOneByCreatedAt(string $created_at) Return the first ChildGroupModule filtered by the created_at column
* @method ChildGroupModule findOneByUpdatedAt(string $updated_at) Return the first ChildGroupModule filtered by the updated_at column
*
* @method array findById(int $id) Return ChildGroupModule objects filtered by the id column
* @method array findByGroupId(int $group_id) Return ChildGroupModule objects filtered by the group_id column
* @method array findByModuleId(int $module_id) Return ChildGroupModule objects filtered by the module_id column
* @method array findByAccess(int $access) Return ChildGroupModule objects filtered by the access column
* @method array findByCreatedAt(string $created_at) Return ChildGroupModule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildGroupModule objects filtered by the updated_at column
*
*/
abstract class GroupModuleQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\GroupModuleQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\GroupModule', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildGroupModuleQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildGroupModuleQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\GroupModuleQuery) {
return $criteria;
}
$query = new \Thelia\Model\GroupModuleQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildGroupModule|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = GroupModuleTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(GroupModuleTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroupModule A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, GROUP_ID, MODULE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM group_module WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildGroupModule();
$obj->hydrate($row);
GroupModuleTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroupModule|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(GroupModuleTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(GroupModuleTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(GroupModuleTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(GroupModuleTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupModuleTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the group_id column
*
* Example usage:
* <code>
* $query->filterByGroupId(1234); // WHERE group_id = 1234
* $query->filterByGroupId(array(12, 34)); // WHERE group_id IN (12, 34)
* $query->filterByGroupId(array('min' => 12)); // WHERE group_id > 12
* </code>
*
* @see filterByGroup()
*
* @param mixed $groupId 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByGroupId($groupId = null, $comparison = null)
{
if (is_array($groupId)) {
$useMinMax = false;
if (isset($groupId['min'])) {
$this->addUsingAlias(GroupModuleTableMap::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($groupId['max'])) {
$this->addUsingAlias(GroupModuleTableMap::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupModuleTableMap::GROUP_ID, $groupId, $comparison);
}
/**
* Filter the query on the module_id column
*
* Example usage:
* <code>
* $query->filterByModuleId(1234); // WHERE module_id = 1234
* $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34)
* $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12
* </code>
*
* @see filterByModule()
*
* @param mixed $moduleId 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByModuleId($moduleId = null, $comparison = null)
{
if (is_array($moduleId)) {
$useMinMax = false;
if (isset($moduleId['min'])) {
$this->addUsingAlias(GroupModuleTableMap::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($moduleId['max'])) {
$this->addUsingAlias(GroupModuleTableMap::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupModuleTableMap::MODULE_ID, $moduleId, $comparison);
}
/**
* Filter the query on the access column
*
* Example usage:
* <code>
* $query->filterByAccess(1234); // WHERE access = 1234
* $query->filterByAccess(array(12, 34)); // WHERE access IN (12, 34)
* $query->filterByAccess(array('min' => 12)); // WHERE access > 12
* </code>
*
* @param mixed $access 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByAccess($access = null, $comparison = null)
{
if (is_array($access)) {
$useMinMax = false;
if (isset($access['min'])) {
$this->addUsingAlias(GroupModuleTableMap::ACCESS, $access['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($access['max'])) {
$this->addUsingAlias(GroupModuleTableMap::ACCESS, $access['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupModuleTableMap::ACCESS, $access, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(GroupModuleTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(GroupModuleTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupModuleTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(GroupModuleTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(GroupModuleTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupModuleTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Group object
*
* @param \Thelia\Model\Group|ObjectCollection $group The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = null)
{
if ($group instanceof \Thelia\Model\Group) {
return $this
->addUsingAlias(GroupModuleTableMap::GROUP_ID, $group->getId(), $comparison);
} elseif ($group instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(GroupModuleTableMap::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByGroup() only accepts arguments of type \Thelia\Model\Group or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Group relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Group');
// 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, 'Group');
}
return $this;
}
/**
* Use the Group relation Group 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\GroupQuery A secondary query class using the current class as primary query
*/
public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function filterByModule($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(GroupModuleTableMap::MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(GroupModuleTableMap::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Module relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
// 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, 'Module');
}
return $this;
}
/**
* Use the Module relation Module 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\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
}
/**
* Exclude object from result
*
* @param ChildGroupModule $groupModule Object to remove from the list of results
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function prune($groupModule = null)
{
if ($groupModule) {
$this->addUsingAlias(GroupModuleTableMap::ID, $groupModule->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the group_module table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupModuleTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
GroupModuleTableMap::clearInstancePool();
GroupModuleTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildGroupModule or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildGroupModule object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupModuleTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(GroupModuleTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
GroupModuleTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
GroupModuleTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(GroupModuleTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(GroupModuleTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(GroupModuleTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(GroupModuleTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(GroupModuleTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildGroupModuleQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(GroupModuleTableMap::CREATED_AT);
}
} // GroupModuleQuery

View File

@@ -1,940 +0,0 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Group as ChildGroup;
use Thelia\Model\GroupI18nQuery as ChildGroupI18nQuery;
use Thelia\Model\GroupQuery as ChildGroupQuery;
use Thelia\Model\Map\GroupTableMap;
/**
* Base class that represents a query for the 'group' table.
*
*
*
* @method ChildGroupQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildGroupQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildGroupQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildGroupQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildGroupQuery groupById() Group by the id column
* @method ChildGroupQuery groupByCode() Group by the code column
* @method ChildGroupQuery groupByCreatedAt() Group by the created_at column
* @method ChildGroupQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildGroupQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildGroupQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildGroupQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildGroupQuery leftJoinAdminGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminGroup relation
* @method ChildGroupQuery rightJoinAdminGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminGroup relation
* @method ChildGroupQuery innerJoinAdminGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminGroup relation
*
* @method ChildGroupQuery leftJoinGroupResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupResource relation
* @method ChildGroupQuery rightJoinGroupResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupResource relation
* @method ChildGroupQuery innerJoinGroupResource($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupResource relation
*
* @method ChildGroupQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation
* @method ChildGroupQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method ChildGroupQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
*
* @method ChildGroupQuery leftJoinGroupI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupI18n relation
* @method ChildGroupQuery rightJoinGroupI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupI18n relation
* @method ChildGroupQuery innerJoinGroupI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupI18n relation
*
* @method ChildGroup findOne(ConnectionInterface $con = null) Return the first ChildGroup matching the query
* @method ChildGroup findOneOrCreate(ConnectionInterface $con = null) Return the first ChildGroup matching the query, or a new ChildGroup object populated from the query conditions when no match is found
*
* @method ChildGroup findOneById(int $id) Return the first ChildGroup filtered by the id column
* @method ChildGroup findOneByCode(string $code) Return the first ChildGroup filtered by the code column
* @method ChildGroup findOneByCreatedAt(string $created_at) Return the first ChildGroup filtered by the created_at column
* @method ChildGroup findOneByUpdatedAt(string $updated_at) Return the first ChildGroup filtered by the updated_at column
*
* @method array findById(int $id) Return ChildGroup objects filtered by the id column
* @method array findByCode(string $code) Return ChildGroup objects filtered by the code column
* @method array findByCreatedAt(string $created_at) Return ChildGroup objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildGroup objects filtered by the updated_at column
*
*/
abstract class GroupQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\GroupQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Group', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildGroupQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildGroupQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\GroupQuery) {
return $criteria;
}
$query = new \Thelia\Model\GroupQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildGroup|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = GroupTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(GroupTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroup A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CODE, CREATED_AT, UPDATED_AT FROM group WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildGroup();
$obj->hydrate($row);
GroupTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroup|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(GroupTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(GroupTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(GroupTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(GroupTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the code column
*
* Example usage:
* <code>
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
* </code>
*
* @param string $code 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 ChildGroupQuery The current query, for fluid interface
*/
public function filterByCode($code = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($code)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $code)) {
$code = str_replace('*', '%', $code);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(GroupTableMap::CODE, $code, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(GroupTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(GroupTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(GroupTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(GroupTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\AdminGroup object
*
* @param \Thelia\Model\AdminGroup|ObjectCollection $adminGroup the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByAdminGroup($adminGroup, $comparison = null)
{
if ($adminGroup instanceof \Thelia\Model\AdminGroup) {
return $this
->addUsingAlias(GroupTableMap::ID, $adminGroup->getGroupId(), $comparison);
} elseif ($adminGroup instanceof ObjectCollection) {
return $this
->useAdminGroupQuery()
->filterByPrimaryKeys($adminGroup->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAdminGroup() only accepts arguments of type \Thelia\Model\AdminGroup or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AdminGroup relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AdminGroup');
// 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, 'AdminGroup');
}
return $this;
}
/**
* Use the AdminGroup relation AdminGroup 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\AdminGroupQuery A secondary query class using the current class as primary query
*/
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAdminGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AdminGroup', '\Thelia\Model\AdminGroupQuery');
}
/**
* Filter the query by a related \Thelia\Model\GroupResource object
*
* @param \Thelia\Model\GroupResource|ObjectCollection $groupResource the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByGroupResource($groupResource, $comparison = null)
{
if ($groupResource instanceof \Thelia\Model\GroupResource) {
return $this
->addUsingAlias(GroupTableMap::ID, $groupResource->getGroupId(), $comparison);
} elseif ($groupResource instanceof ObjectCollection) {
return $this
->useGroupResourceQuery()
->filterByPrimaryKeys($groupResource->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByGroupResource() only accepts arguments of type \Thelia\Model\GroupResource or Collection');
}
}
/**
* Adds a JOIN clause to the query using the GroupResource relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function joinGroupResource($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('GroupResource');
// 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, 'GroupResource');
}
return $this;
}
/**
* Use the GroupResource relation GroupResource 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\GroupResourceQuery A secondary query class using the current class as primary query
*/
public function useGroupResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroupResource($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'GroupResource', '\Thelia\Model\GroupResourceQuery');
}
/**
* Filter the query by a related \Thelia\Model\GroupModule object
*
* @param \Thelia\Model\GroupModule|ObjectCollection $groupModule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByGroupModule($groupModule, $comparison = null)
{
if ($groupModule instanceof \Thelia\Model\GroupModule) {
return $this
->addUsingAlias(GroupTableMap::ID, $groupModule->getGroupId(), $comparison);
} elseif ($groupModule instanceof ObjectCollection) {
return $this
->useGroupModuleQuery()
->filterByPrimaryKeys($groupModule->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByGroupModule() only accepts arguments of type \Thelia\Model\GroupModule or Collection');
}
}
/**
* Adds a JOIN clause to the query using the GroupModule relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function joinGroupModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('GroupModule');
// 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, 'GroupModule');
}
return $this;
}
/**
* Use the GroupModule relation GroupModule 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\GroupModuleQuery A secondary query class using the current class as primary query
*/
public function useGroupModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroupModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery');
}
/**
* Filter the query by a related \Thelia\Model\GroupI18n object
*
* @param \Thelia\Model\GroupI18n|ObjectCollection $groupI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByGroupI18n($groupI18n, $comparison = null)
{
if ($groupI18n instanceof \Thelia\Model\GroupI18n) {
return $this
->addUsingAlias(GroupTableMap::ID, $groupI18n->getId(), $comparison);
} elseif ($groupI18n instanceof ObjectCollection) {
return $this
->useGroupI18nQuery()
->filterByPrimaryKeys($groupI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByGroupI18n() only accepts arguments of type \Thelia\Model\GroupI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the GroupI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function joinGroupI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('GroupI18n');
// 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, 'GroupI18n');
}
return $this;
}
/**
* Use the GroupI18n relation GroupI18n 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\GroupI18nQuery A secondary query class using the current class as primary query
*/
public function useGroupI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinGroupI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'GroupI18n', '\Thelia\Model\GroupI18nQuery');
}
/**
* Filter the query by a related Admin object
* using the admin_group table as cross reference
*
* @param Admin $admin the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByAdmin($admin, $comparison = Criteria::EQUAL)
{
return $this
->useAdminGroupQuery()
->filterByAdmin($admin, $comparison)
->endUse();
}
/**
* Filter the query by a related Resource object
* using the group_resource table as cross reference
*
* @param Resource $resource the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function filterByResource($resource, $comparison = Criteria::EQUAL)
{
return $this
->useGroupResourceQuery()
->filterByResource($resource, $comparison)
->endUse();
}
/**
* Exclude object from result
*
* @param ChildGroup $group Object to remove from the list of results
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function prune($group = null)
{
if ($group) {
$this->addUsingAlias(GroupTableMap::ID, $group->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the group table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
GroupTableMap::clearInstancePool();
GroupTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildGroup or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildGroup object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(GroupTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
GroupTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
GroupTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(GroupTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(GroupTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(GroupTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(GroupTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(GroupTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(GroupTableMap::CREATED_AT);
}
// i18n behavior
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'GroupI18n';
return $this
->joinGroupI18n($relationAlias, $joinType)
->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
}
/**
* Adds a JOIN clause to the query and hydrates the related I18n object.
* Shortcut for $c->joinI18n($locale)->with()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildGroupQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('GroupI18n');
$this->with['GroupI18n']->setIsWithOneToMany(false);
return $this;
}
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildGroupI18nQuery A secondary query class using the current class as primary query
*/
public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinI18n($locale, $relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'GroupI18n', '\Thelia\Model\GroupI18nQuery');
}
} // GroupQuery

File diff suppressed because it is too large Load Diff

View File

@@ -1,868 +0,0 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\GroupResource as ChildGroupResource;
use Thelia\Model\GroupResourceQuery as ChildGroupResourceQuery;
use Thelia\Model\Map\GroupResourceTableMap;
/**
* Base class that represents a query for the 'group_resource' table.
*
*
*
* @method ChildGroupResourceQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildGroupResourceQuery orderByGroupId($order = Criteria::ASC) Order by the group_id column
* @method ChildGroupResourceQuery orderByResourceId($order = Criteria::ASC) Order by the resource_id column
* @method ChildGroupResourceQuery orderByRead($order = Criteria::ASC) Order by the read column
* @method ChildGroupResourceQuery orderByWrite($order = Criteria::ASC) Order by the write column
* @method ChildGroupResourceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildGroupResourceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildGroupResourceQuery groupById() Group by the id column
* @method ChildGroupResourceQuery groupByGroupId() Group by the group_id column
* @method ChildGroupResourceQuery groupByResourceId() Group by the resource_id column
* @method ChildGroupResourceQuery groupByRead() Group by the read column
* @method ChildGroupResourceQuery groupByWrite() Group by the write column
* @method ChildGroupResourceQuery groupByCreatedAt() Group by the created_at column
* @method ChildGroupResourceQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildGroupResourceQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildGroupResourceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildGroupResourceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildGroupResourceQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
* @method ChildGroupResourceQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
* @method ChildGroupResourceQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
*
* @method ChildGroupResourceQuery leftJoinResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the Resource relation
* @method ChildGroupResourceQuery rightJoinResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Resource relation
* @method ChildGroupResourceQuery innerJoinResource($relationAlias = null) Adds a INNER JOIN clause to the query using the Resource relation
*
* @method ChildGroupResource findOne(ConnectionInterface $con = null) Return the first ChildGroupResource matching the query
* @method ChildGroupResource findOneOrCreate(ConnectionInterface $con = null) Return the first ChildGroupResource matching the query, or a new ChildGroupResource object populated from the query conditions when no match is found
*
* @method ChildGroupResource findOneById(int $id) Return the first ChildGroupResource filtered by the id column
* @method ChildGroupResource findOneByGroupId(int $group_id) Return the first ChildGroupResource filtered by the group_id column
* @method ChildGroupResource findOneByResourceId(int $resource_id) Return the first ChildGroupResource filtered by the resource_id column
* @method ChildGroupResource findOneByRead(int $read) Return the first ChildGroupResource filtered by the read column
* @method ChildGroupResource findOneByWrite(int $write) Return the first ChildGroupResource filtered by the write column
* @method ChildGroupResource findOneByCreatedAt(string $created_at) Return the first ChildGroupResource filtered by the created_at column
* @method ChildGroupResource findOneByUpdatedAt(string $updated_at) Return the first ChildGroupResource filtered by the updated_at column
*
* @method array findById(int $id) Return ChildGroupResource objects filtered by the id column
* @method array findByGroupId(int $group_id) Return ChildGroupResource objects filtered by the group_id column
* @method array findByResourceId(int $resource_id) Return ChildGroupResource objects filtered by the resource_id column
* @method array findByRead(int $read) Return ChildGroupResource objects filtered by the read column
* @method array findByWrite(int $write) Return ChildGroupResource objects filtered by the write column
* @method array findByCreatedAt(string $created_at) Return ChildGroupResource objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildGroupResource objects filtered by the updated_at column
*
*/
abstract class GroupResourceQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\GroupResourceQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\GroupResource', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildGroupResourceQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildGroupResourceQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\GroupResourceQuery) {
return $criteria;
}
$query = new \Thelia\Model\GroupResourceQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34, 56), $con);
* </code>
*
* @param array[$id, $group_id, $resource_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildGroupResource|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = GroupResourceTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(GroupResourceTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroupResource A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, GROUP_ID, RESOURCE_ID, READ, WRITE, CREATED_AT, UPDATED_AT FROM group_resource WHERE ID = :p0 AND GROUP_ID = :p1 AND RESOURCE_ID = :p2';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildGroupResource();
$obj->hydrate($row);
GroupResourceTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildGroupResource|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(GroupResourceTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(GroupResourceTableMap::GROUP_ID, $key[1], Criteria::EQUAL);
$this->addUsingAlias(GroupResourceTableMap::RESOURCE_ID, $key[2], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(GroupResourceTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(GroupResourceTableMap::GROUP_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$cton2 = $this->getNewCriterion(GroupResourceTableMap::RESOURCE_ID, $key[2], Criteria::EQUAL);
$cton0->addAnd($cton2);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(GroupResourceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(GroupResourceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the group_id column
*
* Example usage:
* <code>
* $query->filterByGroupId(1234); // WHERE group_id = 1234
* $query->filterByGroupId(array(12, 34)); // WHERE group_id IN (12, 34)
* $query->filterByGroupId(array('min' => 12)); // WHERE group_id > 12
* </code>
*
* @see filterByGroup()
*
* @param mixed $groupId 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByGroupId($groupId = null, $comparison = null)
{
if (is_array($groupId)) {
$useMinMax = false;
if (isset($groupId['min'])) {
$this->addUsingAlias(GroupResourceTableMap::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($groupId['max'])) {
$this->addUsingAlias(GroupResourceTableMap::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::GROUP_ID, $groupId, $comparison);
}
/**
* Filter the query on the resource_id column
*
* Example usage:
* <code>
* $query->filterByResourceId(1234); // WHERE resource_id = 1234
* $query->filterByResourceId(array(12, 34)); // WHERE resource_id IN (12, 34)
* $query->filterByResourceId(array('min' => 12)); // WHERE resource_id > 12
* </code>
*
* @see filterByResource()
*
* @param mixed $resourceId 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByResourceId($resourceId = null, $comparison = null)
{
if (is_array($resourceId)) {
$useMinMax = false;
if (isset($resourceId['min'])) {
$this->addUsingAlias(GroupResourceTableMap::RESOURCE_ID, $resourceId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($resourceId['max'])) {
$this->addUsingAlias(GroupResourceTableMap::RESOURCE_ID, $resourceId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::RESOURCE_ID, $resourceId, $comparison);
}
/**
* Filter the query on the read column
*
* Example usage:
* <code>
* $query->filterByRead(1234); // WHERE read = 1234
* $query->filterByRead(array(12, 34)); // WHERE read IN (12, 34)
* $query->filterByRead(array('min' => 12)); // WHERE read > 12
* </code>
*
* @param mixed $read 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByRead($read = null, $comparison = null)
{
if (is_array($read)) {
$useMinMax = false;
if (isset($read['min'])) {
$this->addUsingAlias(GroupResourceTableMap::READ, $read['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($read['max'])) {
$this->addUsingAlias(GroupResourceTableMap::READ, $read['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::READ, $read, $comparison);
}
/**
* Filter the query on the write column
*
* Example usage:
* <code>
* $query->filterByWrite(1234); // WHERE write = 1234
* $query->filterByWrite(array(12, 34)); // WHERE write IN (12, 34)
* $query->filterByWrite(array('min' => 12)); // WHERE write > 12
* </code>
*
* @param mixed $write 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 $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByWrite($write = null, $comparison = null)
{
if (is_array($write)) {
$useMinMax = false;
if (isset($write['min'])) {
$this->addUsingAlias(GroupResourceTableMap::WRITE, $write['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($write['max'])) {
$this->addUsingAlias(GroupResourceTableMap::WRITE, $write['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::WRITE, $write, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(GroupResourceTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(GroupResourceTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(GroupResourceTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(GroupResourceTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(GroupResourceTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Group object
*
* @param \Thelia\Model\Group|ObjectCollection $group The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = null)
{
if ($group instanceof \Thelia\Model\Group) {
return $this
->addUsingAlias(GroupResourceTableMap::GROUP_ID, $group->getId(), $comparison);
} elseif ($group instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(GroupResourceTableMap::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByGroup() only accepts arguments of type \Thelia\Model\Group or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Group relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Group');
// 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, 'Group');
}
return $this;
}
/**
* Use the Group relation Group 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\GroupQuery A secondary query class using the current class as primary query
*/
public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
}
/**
* Filter the query by a related \Thelia\Model\Resource object
*
* @param \Thelia\Model\Resource|ObjectCollection $resource The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function filterByResource($resource, $comparison = null)
{
if ($resource instanceof \Thelia\Model\Resource) {
return $this
->addUsingAlias(GroupResourceTableMap::RESOURCE_ID, $resource->getId(), $comparison);
} elseif ($resource instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(GroupResourceTableMap::RESOURCE_ID, $resource->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByResource() only accepts arguments of type \Thelia\Model\Resource or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Resource relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function joinResource($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Resource');
// 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, 'Resource');
}
return $this;
}
/**
* Use the Resource relation Resource 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\ResourceQuery A secondary query class using the current class as primary query
*/
public function useResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinResource($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Resource', '\Thelia\Model\ResourceQuery');
}
/**
* Exclude object from result
*
* @param ChildGroupResource $groupResource Object to remove from the list of results
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function prune($groupResource = null)
{
if ($groupResource) {
$this->addCond('pruneCond0', $this->getAliasedColName(GroupResourceTableMap::ID), $groupResource->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(GroupResourceTableMap::GROUP_ID), $groupResource->getGroupId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond2', $this->getAliasedColName(GroupResourceTableMap::RESOURCE_ID), $groupResource->getResourceId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the group_resource table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupResourceTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
GroupResourceTableMap::clearInstancePool();
GroupResourceTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildGroupResource or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildGroupResource object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupResourceTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(GroupResourceTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
GroupResourceTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
GroupResourceTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(GroupResourceTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(GroupResourceTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(GroupResourceTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(GroupResourceTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(GroupResourceTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildGroupResourceQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(GroupResourceTableMap::CREATED_AT);
}
} // GroupResourceQuery

View File

@@ -19,8 +19,6 @@ use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\GroupModule as ChildGroupModule;
use Thelia\Model\GroupModuleQuery as ChildGroupModuleQuery;
use Thelia\Model\Module as ChildModule;
use Thelia\Model\ModuleI18n as ChildModuleI18n;
use Thelia\Model\ModuleI18nQuery as ChildModuleI18nQuery;
@@ -29,6 +27,8 @@ use Thelia\Model\ModuleImageQuery as ChildModuleImageQuery;
use Thelia\Model\ModuleQuery as ChildModuleQuery;
use Thelia\Model\Order as ChildOrder;
use Thelia\Model\OrderQuery as ChildOrderQuery;
use Thelia\Model\ProfileModule as ChildProfileModule;
use Thelia\Model\ProfileModuleQuery as ChildProfileModuleQuery;
use Thelia\Model\Map\ModuleTableMap;
abstract class Module implements ActiveRecordInterface
@@ -132,10 +132,10 @@ abstract class Module implements ActiveRecordInterface
protected $collAreaDeliveryModulesPartial;
/**
* @var ObjectCollection|ChildGroupModule[] Collection to store aggregation of ChildGroupModule objects.
* @var ObjectCollection|ChildProfileModule[] Collection to store aggregation of ChildProfileModule objects.
*/
protected $collGroupModules;
protected $collGroupModulesPartial;
protected $collProfileModules;
protected $collProfileModulesPartial;
/**
* @var ObjectCollection|ChildModuleImage[] Collection to store aggregation of ChildModuleImage objects.
@@ -193,7 +193,7 @@ abstract class Module implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $groupModulesScheduledForDeletion = null;
protected $profileModulesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -880,7 +880,7 @@ abstract class Module implements ActiveRecordInterface
$this->collAreaDeliveryModules = null;
$this->collGroupModules = null;
$this->collProfileModules = null;
$this->collModuleImages = null;
@@ -1070,17 +1070,17 @@ abstract class Module implements ActiveRecordInterface
}
}
if ($this->groupModulesScheduledForDeletion !== null) {
if (!$this->groupModulesScheduledForDeletion->isEmpty()) {
\Thelia\Model\GroupModuleQuery::create()
->filterByPrimaryKeys($this->groupModulesScheduledForDeletion->getPrimaryKeys(false))
if ($this->profileModulesScheduledForDeletion !== null) {
if (!$this->profileModulesScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProfileModuleQuery::create()
->filterByPrimaryKeys($this->profileModulesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->groupModulesScheduledForDeletion = null;
$this->profileModulesScheduledForDeletion = null;
}
}
if ($this->collGroupModules !== null) {
foreach ($this->collGroupModules as $referrerFK) {
if ($this->collProfileModules !== null) {
foreach ($this->collProfileModules as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1345,8 +1345,8 @@ abstract class Module implements ActiveRecordInterface
if (null !== $this->collAreaDeliveryModules) {
$result['AreaDeliveryModules'] = $this->collAreaDeliveryModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collGroupModules) {
$result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
if (null !== $this->collProfileModules) {
$result['ProfileModules'] = $this->collProfileModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collModuleImages) {
$result['ModuleImages'] = $this->collModuleImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
@@ -1557,9 +1557,9 @@ abstract class Module implements ActiveRecordInterface
}
}
foreach ($this->getGroupModules() as $relObj) {
foreach ($this->getProfileModules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addGroupModule($relObj->copy($deepCopy));
$copyObj->addProfileModule($relObj->copy($deepCopy));
}
}
@@ -1625,8 +1625,8 @@ abstract class Module implements ActiveRecordInterface
if ('AreaDeliveryModule' == $relationName) {
return $this->initAreaDeliveryModules();
}
if ('GroupModule' == $relationName) {
return $this->initGroupModules();
if ('ProfileModule' == $relationName) {
return $this->initProfileModules();
}
if ('ModuleImage' == $relationName) {
return $this->initModuleImages();
@@ -2616,31 +2616,31 @@ abstract class Module implements ActiveRecordInterface
}
/**
* Clears out the collGroupModules collection
* Clears out the collProfileModules 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 addGroupModules()
* @see addProfileModules()
*/
public function clearGroupModules()
public function clearProfileModules()
{
$this->collGroupModules = null; // important to set this to NULL since that means it is uninitialized
$this->collProfileModules = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collGroupModules collection loaded partially.
* Reset is the collProfileModules collection loaded partially.
*/
public function resetPartialGroupModules($v = true)
public function resetPartialProfileModules($v = true)
{
$this->collGroupModulesPartial = $v;
$this->collProfileModulesPartial = $v;
}
/**
* Initializes the collGroupModules collection.
* Initializes the collProfileModules collection.
*
* By default this just sets the collGroupModules collection to an empty array (like clearcollGroupModules());
* By default this just sets the collProfileModules collection to an empty array (like clearcollProfileModules());
* 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.
*
@@ -2649,17 +2649,17 @@ abstract class Module implements ActiveRecordInterface
*
* @return void
*/
public function initGroupModules($overrideExisting = true)
public function initProfileModules($overrideExisting = true)
{
if (null !== $this->collGroupModules && !$overrideExisting) {
if (null !== $this->collProfileModules && !$overrideExisting) {
return;
}
$this->collGroupModules = new ObjectCollection();
$this->collGroupModules->setModel('\Thelia\Model\GroupModule');
$this->collProfileModules = new ObjectCollection();
$this->collProfileModules->setModel('\Thelia\Model\ProfileModule');
}
/**
* Gets an array of ChildGroupModule objects which contain a foreign key that references this object.
* Gets an array of ChildProfileModule 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.
@@ -2669,109 +2669,109 @@ abstract class Module implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildGroupModule[] List of ChildGroupModule objects
* @return Collection|ChildProfileModule[] List of ChildProfileModule objects
* @throws PropelException
*/
public function getGroupModules($criteria = null, ConnectionInterface $con = null)
public function getProfileModules($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collGroupModulesPartial && !$this->isNew();
if (null === $this->collGroupModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collGroupModules) {
$partial = $this->collProfileModulesPartial && !$this->isNew();
if (null === $this->collProfileModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collProfileModules) {
// return empty collection
$this->initGroupModules();
$this->initProfileModules();
} else {
$collGroupModules = ChildGroupModuleQuery::create(null, $criteria)
$collProfileModules = ChildProfileModuleQuery::create(null, $criteria)
->filterByModule($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collGroupModulesPartial && count($collGroupModules)) {
$this->initGroupModules(false);
if (false !== $this->collProfileModulesPartial && count($collProfileModules)) {
$this->initProfileModules(false);
foreach ($collGroupModules as $obj) {
if (false == $this->collGroupModules->contains($obj)) {
$this->collGroupModules->append($obj);
foreach ($collProfileModules as $obj) {
if (false == $this->collProfileModules->contains($obj)) {
$this->collProfileModules->append($obj);
}
}
$this->collGroupModulesPartial = true;
$this->collProfileModulesPartial = true;
}
$collGroupModules->getInternalIterator()->rewind();
$collProfileModules->getInternalIterator()->rewind();
return $collGroupModules;
return $collProfileModules;
}
if ($partial && $this->collGroupModules) {
foreach ($this->collGroupModules as $obj) {
if ($partial && $this->collProfileModules) {
foreach ($this->collProfileModules as $obj) {
if ($obj->isNew()) {
$collGroupModules[] = $obj;
$collProfileModules[] = $obj;
}
}
}
$this->collGroupModules = $collGroupModules;
$this->collGroupModulesPartial = false;
$this->collProfileModules = $collProfileModules;
$this->collProfileModulesPartial = false;
}
}
return $this->collGroupModules;
return $this->collProfileModules;
}
/**
* Sets a collection of GroupModule objects related by a one-to-many relationship
* Sets a collection of ProfileModule 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 $groupModules A Propel collection.
* @param Collection $profileModules A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildModule The current object (for fluent API support)
*/
public function setGroupModules(Collection $groupModules, ConnectionInterface $con = null)
public function setProfileModules(Collection $profileModules, ConnectionInterface $con = null)
{
$groupModulesToDelete = $this->getGroupModules(new Criteria(), $con)->diff($groupModules);
$profileModulesToDelete = $this->getProfileModules(new Criteria(), $con)->diff($profileModules);
$this->groupModulesScheduledForDeletion = $groupModulesToDelete;
$this->profileModulesScheduledForDeletion = $profileModulesToDelete;
foreach ($groupModulesToDelete as $groupModuleRemoved) {
$groupModuleRemoved->setModule(null);
foreach ($profileModulesToDelete as $profileModuleRemoved) {
$profileModuleRemoved->setModule(null);
}
$this->collGroupModules = null;
foreach ($groupModules as $groupModule) {
$this->addGroupModule($groupModule);
$this->collProfileModules = null;
foreach ($profileModules as $profileModule) {
$this->addProfileModule($profileModule);
}
$this->collGroupModules = $groupModules;
$this->collGroupModulesPartial = false;
$this->collProfileModules = $profileModules;
$this->collProfileModulesPartial = false;
return $this;
}
/**
* Returns the number of related GroupModule objects.
* Returns the number of related ProfileModule objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related GroupModule objects.
* @return int Count of related ProfileModule objects.
* @throws PropelException
*/
public function countGroupModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countProfileModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collGroupModulesPartial && !$this->isNew();
if (null === $this->collGroupModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collGroupModules) {
$partial = $this->collProfileModulesPartial && !$this->isNew();
if (null === $this->collProfileModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collProfileModules) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getGroupModules());
return count($this->getProfileModules());
}
$query = ChildGroupModuleQuery::create(null, $criteria);
$query = ChildProfileModuleQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2781,53 +2781,53 @@ abstract class Module implements ActiveRecordInterface
->count($con);
}
return count($this->collGroupModules);
return count($this->collProfileModules);
}
/**
* Method called to associate a ChildGroupModule object to this object
* through the ChildGroupModule foreign key attribute.
* Method called to associate a ChildProfileModule object to this object
* through the ChildProfileModule foreign key attribute.
*
* @param ChildGroupModule $l ChildGroupModule
* @param ChildProfileModule $l ChildProfileModule
* @return \Thelia\Model\Module The current object (for fluent API support)
*/
public function addGroupModule(ChildGroupModule $l)
public function addProfileModule(ChildProfileModule $l)
{
if ($this->collGroupModules === null) {
$this->initGroupModules();
$this->collGroupModulesPartial = true;
if ($this->collProfileModules === null) {
$this->initProfileModules();
$this->collProfileModulesPartial = true;
}
if (!in_array($l, $this->collGroupModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddGroupModule($l);
if (!in_array($l, $this->collProfileModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddProfileModule($l);
}
return $this;
}
/**
* @param GroupModule $groupModule The groupModule object to add.
* @param ProfileModule $profileModule The profileModule object to add.
*/
protected function doAddGroupModule($groupModule)
protected function doAddProfileModule($profileModule)
{
$this->collGroupModules[]= $groupModule;
$groupModule->setModule($this);
$this->collProfileModules[]= $profileModule;
$profileModule->setModule($this);
}
/**
* @param GroupModule $groupModule The groupModule object to remove.
* @param ProfileModule $profileModule The profileModule object to remove.
* @return ChildModule The current object (for fluent API support)
*/
public function removeGroupModule($groupModule)
public function removeProfileModule($profileModule)
{
if ($this->getGroupModules()->contains($groupModule)) {
$this->collGroupModules->remove($this->collGroupModules->search($groupModule));
if (null === $this->groupModulesScheduledForDeletion) {
$this->groupModulesScheduledForDeletion = clone $this->collGroupModules;
$this->groupModulesScheduledForDeletion->clear();
if ($this->getProfileModules()->contains($profileModule)) {
$this->collProfileModules->remove($this->collProfileModules->search($profileModule));
if (null === $this->profileModulesScheduledForDeletion) {
$this->profileModulesScheduledForDeletion = clone $this->collProfileModules;
$this->profileModulesScheduledForDeletion->clear();
}
$this->groupModulesScheduledForDeletion[]= $groupModule;
$groupModule->setModule(null);
$this->profileModulesScheduledForDeletion[]= $profileModule;
$profileModule->setModule(null);
}
return $this;
@@ -2839,7 +2839,7 @@ abstract class Module implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Module is new, it will return
* an empty collection; or if this Module has previously
* been saved, it will retrieve related GroupModules from storage.
* been saved, it will retrieve related ProfileModules from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -2848,14 +2848,14 @@ abstract class Module implements ActiveRecordInterface
* @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|ChildGroupModule[] List of ChildGroupModule objects
* @return Collection|ChildProfileModule[] List of ChildProfileModule objects
*/
public function getGroupModulesJoinGroup($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
public function getProfileModulesJoinProfile($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildGroupModuleQuery::create(null, $criteria);
$query->joinWith('Group', $joinBehavior);
$query = ChildProfileModuleQuery::create(null, $criteria);
$query->joinWith('Profile', $joinBehavior);
return $this->getGroupModules($query, $con);
return $this->getProfileModules($query, $con);
}
/**
@@ -3348,8 +3348,8 @@ abstract class Module implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collGroupModules) {
foreach ($this->collGroupModules as $o) {
if ($this->collProfileModules) {
foreach ($this->collProfileModules as $o) {
$o->clearAllReferences($deep);
}
}
@@ -3381,10 +3381,10 @@ abstract class Module implements ActiveRecordInterface
$this->collAreaDeliveryModules->clearIterator();
}
$this->collAreaDeliveryModules = null;
if ($this->collGroupModules instanceof Collection) {
$this->collGroupModules->clearIterator();
if ($this->collProfileModules instanceof Collection) {
$this->collProfileModules->clearIterator();
}
$this->collGroupModules = null;
$this->collProfileModules = null;
if ($this->collModuleImages instanceof Collection) {
$this->collModuleImages->clearIterator();
}

View File

@@ -56,9 +56,9 @@ use Thelia\Model\Map\ModuleTableMap;
* @method ChildModuleQuery rightJoinAreaDeliveryModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildModuleQuery innerJoinAreaDeliveryModule($relationAlias = null) Adds a INNER JOIN clause to the query using the AreaDeliveryModule relation
*
* @method ChildModuleQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery leftJoinProfileModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProfileModule relation
* @method ChildModuleQuery rightJoinProfileModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProfileModule relation
* @method ChildModuleQuery innerJoinProfileModule($relationAlias = null) Adds a INNER JOIN clause to the query using the ProfileModule relation
*
* @method ChildModuleQuery leftJoinModuleImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleImage relation
* @method ChildModuleQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
@@ -793,40 +793,40 @@ abstract class ModuleQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\GroupModule object
* Filter the query by a related \Thelia\Model\ProfileModule object
*
* @param \Thelia\Model\GroupModule|ObjectCollection $groupModule the related object to use as filter
* @param \Thelia\Model\ProfileModule|ObjectCollection $profileModule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function filterByGroupModule($groupModule, $comparison = null)
public function filterByProfileModule($profileModule, $comparison = null)
{
if ($groupModule instanceof \Thelia\Model\GroupModule) {
if ($profileModule instanceof \Thelia\Model\ProfileModule) {
return $this
->addUsingAlias(ModuleTableMap::ID, $groupModule->getModuleId(), $comparison);
} elseif ($groupModule instanceof ObjectCollection) {
->addUsingAlias(ModuleTableMap::ID, $profileModule->getModuleId(), $comparison);
} elseif ($profileModule instanceof ObjectCollection) {
return $this
->useGroupModuleQuery()
->filterByPrimaryKeys($groupModule->getPrimaryKeys())
->useProfileModuleQuery()
->filterByPrimaryKeys($profileModule->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByGroupModule() only accepts arguments of type \Thelia\Model\GroupModule or Collection');
throw new PropelException('filterByProfileModule() only accepts arguments of type \Thelia\Model\ProfileModule or Collection');
}
}
/**
* Adds a JOIN clause to the query using the GroupModule relation
* Adds a JOIN clause to the query using the ProfileModule relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinGroupModule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function joinProfileModule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('GroupModule');
$relationMap = $tableMap->getRelation('ProfileModule');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -841,14 +841,14 @@ abstract class ModuleQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'GroupModule');
$this->addJoinObject($join, 'ProfileModule');
}
return $this;
}
/**
* Use the GroupModule relation GroupModule object
* Use the ProfileModule relation ProfileModule object
*
* @see useQuery()
*
@@ -856,13 +856,13 @@ abstract class ModuleQuery extends ModelCriteria
* 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\GroupModuleQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\ProfileModuleQuery A secondary query class using the current class as primary query
*/
public function useGroupModuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function useProfileModuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinGroupModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery');
->joinProfileModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ProfileModule', '\Thelia\Model\ProfileModuleQuery');
}
/**

View File

@@ -145,6 +145,12 @@ abstract class OrderProduct implements ActiveRecordInterface
*/
protected $weight;
/**
* The value for the ean_code field.
* @var string
*/
protected $ean_code;
/**
* The value for the tax_rule_title field.
* @var string
@@ -624,6 +630,17 @@ abstract class OrderProduct implements ActiveRecordInterface
return $this->weight;
}
/**
* Get the [ean_code] column value.
*
* @return string
*/
public function getEanCode()
{
return $this->ean_code;
}
/**
* Get the [tax_rule_title] column value.
*
@@ -995,6 +1012,27 @@ abstract class OrderProduct implements ActiveRecordInterface
return $this;
} // setWeight()
/**
* Set the value of [ean_code] column.
*
* @param string $v new value
* @return \Thelia\Model\OrderProduct The current object (for fluent API support)
*/
public function setEanCode($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->ean_code !== $v) {
$this->ean_code = $v;
$this->modifiedColumns[] = OrderProductTableMap::EAN_CODE;
}
return $this;
} // setEanCode()
/**
* Set the value of [tax_rule_title] column.
*
@@ -1179,22 +1217,25 @@ abstract class OrderProduct implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderProductTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
$this->weight = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleTitle', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderProductTableMap::translateFieldName('EanCode', TableMap::TYPE_PHPNAME, $indexType)];
$this->ean_code = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleTitle', TableMap::TYPE_PHPNAME, $indexType)];
$this->tax_rule_title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleDescription', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleDescription', TableMap::TYPE_PHPNAME, $indexType)];
$this->tax_rule_description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderProductTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderProductTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)];
$this->parent = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 19 + $startcol : OrderProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -1207,7 +1248,7 @@ abstract class OrderProduct implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 19; // 19 = OrderProductTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 20; // 20 = OrderProductTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\OrderProduct object", 0, $e);
@@ -1523,6 +1564,9 @@ abstract class OrderProduct implements ActiveRecordInterface
if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) {
$modifiedColumns[':p' . $index++] = 'WEIGHT';
}
if ($this->isColumnModified(OrderProductTableMap::EAN_CODE)) {
$modifiedColumns[':p' . $index++] = 'EAN_CODE';
}
if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) {
$modifiedColumns[':p' . $index++] = 'TAX_RULE_TITLE';
}
@@ -1591,6 +1635,9 @@ abstract class OrderProduct implements ActiveRecordInterface
case 'WEIGHT':
$stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR);
break;
case 'EAN_CODE':
$stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR);
break;
case 'TAX_RULE_TITLE':
$stmt->bindValue($identifier, $this->tax_rule_title, PDO::PARAM_STR);
break;
@@ -1711,18 +1758,21 @@ abstract class OrderProduct implements ActiveRecordInterface
return $this->getWeight();
break;
case 14:
return $this->getTaxRuleTitle();
return $this->getEanCode();
break;
case 15:
return $this->getTaxRuleDescription();
return $this->getTaxRuleTitle();
break;
case 16:
return $this->getParent();
return $this->getTaxRuleDescription();
break;
case 17:
return $this->getCreatedAt();
return $this->getParent();
break;
case 18:
return $this->getCreatedAt();
break;
case 19:
return $this->getUpdatedAt();
break;
default:
@@ -1768,11 +1818,12 @@ abstract class OrderProduct implements ActiveRecordInterface
$keys[11] => $this->getWasNew(),
$keys[12] => $this->getWasInPromo(),
$keys[13] => $this->getWeight(),
$keys[14] => $this->getTaxRuleTitle(),
$keys[15] => $this->getTaxRuleDescription(),
$keys[16] => $this->getParent(),
$keys[17] => $this->getCreatedAt(),
$keys[18] => $this->getUpdatedAt(),
$keys[14] => $this->getEanCode(),
$keys[15] => $this->getTaxRuleTitle(),
$keys[16] => $this->getTaxRuleDescription(),
$keys[17] => $this->getParent(),
$keys[18] => $this->getCreatedAt(),
$keys[19] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1866,18 +1917,21 @@ abstract class OrderProduct implements ActiveRecordInterface
$this->setWeight($value);
break;
case 14:
$this->setTaxRuleTitle($value);
$this->setEanCode($value);
break;
case 15:
$this->setTaxRuleDescription($value);
$this->setTaxRuleTitle($value);
break;
case 16:
$this->setParent($value);
$this->setTaxRuleDescription($value);
break;
case 17:
$this->setCreatedAt($value);
$this->setParent($value);
break;
case 18:
$this->setCreatedAt($value);
break;
case 19:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1918,11 +1972,12 @@ abstract class OrderProduct implements ActiveRecordInterface
if (array_key_exists($keys[11], $arr)) $this->setWasNew($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setWasInPromo($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setWeight($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setTaxRuleTitle($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setTaxRuleDescription($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setParent($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
if (array_key_exists($keys[14], $arr)) $this->setEanCode($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setTaxRuleTitle($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setTaxRuleDescription($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setParent($arr[$keys[17]]);
if (array_key_exists($keys[18], $arr)) $this->setCreatedAt($arr[$keys[18]]);
if (array_key_exists($keys[19], $arr)) $this->setUpdatedAt($arr[$keys[19]]);
}
/**
@@ -1948,6 +2003,7 @@ abstract class OrderProduct implements ActiveRecordInterface
if ($this->isColumnModified(OrderProductTableMap::WAS_NEW)) $criteria->add(OrderProductTableMap::WAS_NEW, $this->was_new);
if ($this->isColumnModified(OrderProductTableMap::WAS_IN_PROMO)) $criteria->add(OrderProductTableMap::WAS_IN_PROMO, $this->was_in_promo);
if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) $criteria->add(OrderProductTableMap::WEIGHT, $this->weight);
if ($this->isColumnModified(OrderProductTableMap::EAN_CODE)) $criteria->add(OrderProductTableMap::EAN_CODE, $this->ean_code);
if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) $criteria->add(OrderProductTableMap::TAX_RULE_TITLE, $this->tax_rule_title);
if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_DESCRIPTION)) $criteria->add(OrderProductTableMap::TAX_RULE_DESCRIPTION, $this->tax_rule_description);
if ($this->isColumnModified(OrderProductTableMap::PARENT)) $criteria->add(OrderProductTableMap::PARENT, $this->parent);
@@ -2029,6 +2085,7 @@ abstract class OrderProduct implements ActiveRecordInterface
$copyObj->setWasNew($this->getWasNew());
$copyObj->setWasInPromo($this->getWasInPromo());
$copyObj->setWeight($this->getWeight());
$copyObj->setEanCode($this->getEanCode());
$copyObj->setTaxRuleTitle($this->getTaxRuleTitle());
$copyObj->setTaxRuleDescription($this->getTaxRuleDescription());
$copyObj->setParent($this->getParent());
@@ -2607,6 +2664,7 @@ abstract class OrderProduct implements ActiveRecordInterface
$this->was_new = null;
$this->was_in_promo = null;
$this->weight = null;
$this->ean_code = null;
$this->tax_rule_title = null;
$this->tax_rule_description = null;
$this->parent = null;

View File

@@ -35,6 +35,7 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery orderByWasNew($order = Criteria::ASC) Order by the was_new column
* @method ChildOrderProductQuery orderByWasInPromo($order = Criteria::ASC) Order by the was_in_promo column
* @method ChildOrderProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column
* @method ChildOrderProductQuery orderByEanCode($order = Criteria::ASC) Order by the ean_code column
* @method ChildOrderProductQuery orderByTaxRuleTitle($order = Criteria::ASC) Order by the tax_rule_title column
* @method ChildOrderProductQuery orderByTaxRuleDescription($order = Criteria::ASC) Order by the tax_rule_description column
* @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column
@@ -55,6 +56,7 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery groupByWasNew() Group by the was_new column
* @method ChildOrderProductQuery groupByWasInPromo() Group by the was_in_promo column
* @method ChildOrderProductQuery groupByWeight() Group by the weight column
* @method ChildOrderProductQuery groupByEanCode() Group by the ean_code column
* @method ChildOrderProductQuery groupByTaxRuleTitle() Group by the tax_rule_title column
* @method ChildOrderProductQuery groupByTaxRuleDescription() Group by the tax_rule_description column
* @method ChildOrderProductQuery groupByParent() Group by the parent column
@@ -94,6 +96,7 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProduct findOneByWasNew(int $was_new) Return the first ChildOrderProduct filtered by the was_new column
* @method ChildOrderProduct findOneByWasInPromo(int $was_in_promo) Return the first ChildOrderProduct filtered by the was_in_promo column
* @method ChildOrderProduct findOneByWeight(string $weight) Return the first ChildOrderProduct filtered by the weight column
* @method ChildOrderProduct findOneByEanCode(string $ean_code) Return the first ChildOrderProduct filtered by the ean_code column
* @method ChildOrderProduct findOneByTaxRuleTitle(string $tax_rule_title) Return the first ChildOrderProduct filtered by the tax_rule_title column
* @method ChildOrderProduct findOneByTaxRuleDescription(string $tax_rule_description) Return the first ChildOrderProduct filtered by the tax_rule_description column
* @method ChildOrderProduct findOneByParent(int $parent) Return the first ChildOrderProduct filtered by the parent column
@@ -114,6 +117,7 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method array findByWasNew(int $was_new) Return ChildOrderProduct objects filtered by the was_new column
* @method array findByWasInPromo(int $was_in_promo) Return ChildOrderProduct objects filtered by the was_in_promo column
* @method array findByWeight(string $weight) Return ChildOrderProduct objects filtered by the weight column
* @method array findByEanCode(string $ean_code) Return ChildOrderProduct objects filtered by the ean_code column
* @method array findByTaxRuleTitle(string $tax_rule_title) Return ChildOrderProduct objects filtered by the tax_rule_title column
* @method array findByTaxRuleDescription(string $tax_rule_description) Return ChildOrderProduct objects filtered by the tax_rule_description column
* @method array findByParent(int $parent) Return ChildOrderProduct objects filtered by the parent column
@@ -207,7 +211,7 @@ abstract class OrderProductQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, EAN_CODE, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -776,6 +780,35 @@ abstract class OrderProductQuery extends ModelCriteria
return $this->addUsingAlias(OrderProductTableMap::WEIGHT, $weight, $comparison);
}
/**
* Filter the query on the ean_code column
*
* Example usage:
* <code>
* $query->filterByEanCode('fooValue'); // WHERE ean_code = 'fooValue'
* $query->filterByEanCode('%fooValue%'); // WHERE ean_code LIKE '%fooValue%'
* </code>
*
* @param string $eanCode 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByEanCode($eanCode = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($eanCode)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $eanCode)) {
$eanCode = str_replace('*', '%', $eanCode);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::EAN_CODE, $eanCode, $comparison);
}
/**
* Filter the query on the tax_rule_title column
*

View File

@@ -115,6 +115,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
*/
protected $is_default;
/**
* The value for the ean_code field.
* @var string
*/
protected $ean_code;
/**
* The value for the created_at field.
* @var string
@@ -538,6 +544,17 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this->is_default;
}
/**
* Get the [ean_code] column value.
*
* @return string
*/
public function getEanCode()
{
return $this->ean_code;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -758,6 +775,27 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this;
} // setIsDefault()
/**
* Set the value of [ean_code] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductSaleElements The current object (for fluent API support)
*/
public function setEanCode($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->ean_code !== $v) {
$this->ean_code = $v;
$this->modifiedColumns[] = ProductSaleElementsTableMap::EAN_CODE;
}
return $this;
} // setEanCode()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -877,13 +915,16 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
$this->is_default = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('EanCode', TableMap::TYPE_PHPNAME, $indexType)];
$this->ean_code = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -896,7 +937,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 10; // 10 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 11; // 11 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductSaleElements object", 0, $e);
@@ -1213,6 +1254,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) {
$modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
}
if ($this->isColumnModified(ProductSaleElementsTableMap::EAN_CODE)) {
$modifiedColumns[':p' . $index++] = 'EAN_CODE';
}
if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1254,6 +1298,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
case 'IS_DEFAULT':
$stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT);
break;
case 'EAN_CODE':
$stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1347,9 +1394,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this->getIsDefault();
break;
case 8:
return $this->getCreatedAt();
return $this->getEanCode();
break;
case 9:
return $this->getCreatedAt();
break;
case 10:
return $this->getUpdatedAt();
break;
default:
@@ -1389,8 +1439,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$keys[5] => $this->getNewness(),
$keys[6] => $this->getWeight(),
$keys[7] => $this->getIsDefault(),
$keys[8] => $this->getCreatedAt(),
$keys[9] => $this->getUpdatedAt(),
$keys[8] => $this->getEanCode(),
$keys[9] => $this->getCreatedAt(),
$keys[10] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1469,9 +1520,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->setIsDefault($value);
break;
case 8:
$this->setCreatedAt($value);
$this->setEanCode($value);
break;
case 9:
$this->setCreatedAt($value);
break;
case 10:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1506,8 +1560,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if (array_key_exists($keys[5], $arr)) $this->setNewness($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setWeight($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setIsDefault($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]);
if (array_key_exists($keys[8], $arr)) $this->setEanCode($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
}
/**
@@ -1527,6 +1582,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if ($this->isColumnModified(ProductSaleElementsTableMap::NEWNESS)) $criteria->add(ProductSaleElementsTableMap::NEWNESS, $this->newness);
if ($this->isColumnModified(ProductSaleElementsTableMap::WEIGHT)) $criteria->add(ProductSaleElementsTableMap::WEIGHT, $this->weight);
if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) $criteria->add(ProductSaleElementsTableMap::IS_DEFAULT, $this->is_default);
if ($this->isColumnModified(ProductSaleElementsTableMap::EAN_CODE)) $criteria->add(ProductSaleElementsTableMap::EAN_CODE, $this->ean_code);
if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) $criteria->add(ProductSaleElementsTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductSaleElementsTableMap::UPDATED_AT)) $criteria->add(ProductSaleElementsTableMap::UPDATED_AT, $this->updated_at);
@@ -1599,6 +1655,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$copyObj->setNewness($this->getNewness());
$copyObj->setWeight($this->getWeight());
$copyObj->setIsDefault($this->getIsDefault());
$copyObj->setEanCode($this->getEanCode());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -2526,6 +2583,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->newness = null;
$this->weight = null;
$this->is_default = null;
$this->ean_code = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;

View File

@@ -29,6 +29,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method ChildProductSaleElementsQuery orderByNewness($order = Criteria::ASC) Order by the newness column
* @method ChildProductSaleElementsQuery orderByWeight($order = Criteria::ASC) Order by the weight column
* @method ChildProductSaleElementsQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column
* @method ChildProductSaleElementsQuery orderByEanCode($order = Criteria::ASC) Order by the ean_code column
* @method ChildProductSaleElementsQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductSaleElementsQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -40,6 +41,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method ChildProductSaleElementsQuery groupByNewness() Group by the newness column
* @method ChildProductSaleElementsQuery groupByWeight() Group by the weight column
* @method ChildProductSaleElementsQuery groupByIsDefault() Group by the is_default column
* @method ChildProductSaleElementsQuery groupByEanCode() Group by the ean_code column
* @method ChildProductSaleElementsQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductSaleElementsQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -74,6 +76,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method ChildProductSaleElements findOneByNewness(int $newness) Return the first ChildProductSaleElements filtered by the newness column
* @method ChildProductSaleElements findOneByWeight(double $weight) Return the first ChildProductSaleElements filtered by the weight column
* @method ChildProductSaleElements findOneByIsDefault(boolean $is_default) Return the first ChildProductSaleElements filtered by the is_default column
* @method ChildProductSaleElements findOneByEanCode(string $ean_code) Return the first ChildProductSaleElements filtered by the ean_code column
* @method ChildProductSaleElements findOneByCreatedAt(string $created_at) Return the first ChildProductSaleElements filtered by the created_at column
* @method ChildProductSaleElements findOneByUpdatedAt(string $updated_at) Return the first ChildProductSaleElements filtered by the updated_at column
*
@@ -85,6 +88,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method array findByNewness(int $newness) Return ChildProductSaleElements objects filtered by the newness column
* @method array findByWeight(double $weight) Return ChildProductSaleElements objects filtered by the weight column
* @method array findByIsDefault(boolean $is_default) Return ChildProductSaleElements objects filtered by the is_default column
* @method array findByEanCode(string $ean_code) Return ChildProductSaleElements objects filtered by the ean_code column
* @method array findByCreatedAt(string $created_at) Return ChildProductSaleElements objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductSaleElements objects filtered by the updated_at column
*
@@ -175,7 +179,7 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
$sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, IS_DEFAULT, EAN_CODE, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -568,6 +572,35 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
return $this->addUsingAlias(ProductSaleElementsTableMap::IS_DEFAULT, $isDefault, $comparison);
}
/**
* Filter the query on the ean_code column
*
* Example usage:
* <code>
* $query->filterByEanCode('fooValue'); // WHERE ean_code = 'fooValue'
* $query->filterByEanCode('%fooValue%'); // WHERE ean_code LIKE '%fooValue%'
* </code>
*
* @param string $eanCode 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 ChildProductSaleElementsQuery The current query, for fluid interface
*/
public function filterByEanCode($eanCode = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($eanCode)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $eanCode)) {
$eanCode = str_replace('*', '%', $eanCode);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ProductSaleElementsTableMap::EAN_CODE, $eanCode, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -17,10 +17,10 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Group as ChildGroup;
use Thelia\Model\GroupQuery as ChildGroupQuery;
use Thelia\Model\GroupResource as ChildGroupResource;
use Thelia\Model\GroupResourceQuery as ChildGroupResourceQuery;
use Thelia\Model\Profile as ChildProfile;
use Thelia\Model\ProfileQuery as ChildProfileQuery;
use Thelia\Model\ProfileResource as ChildProfileResource;
use Thelia\Model\ProfileResourceQuery as ChildProfileResourceQuery;
use Thelia\Model\Resource as ChildResource;
use Thelia\Model\ResourceI18n as ChildResourceI18n;
use Thelia\Model\ResourceI18nQuery as ChildResourceI18nQuery;
@@ -86,10 +86,10 @@ abstract class Resource implements ActiveRecordInterface
protected $updated_at;
/**
* @var ObjectCollection|ChildGroupResource[] Collection to store aggregation of ChildGroupResource objects.
* @var ObjectCollection|ChildProfileResource[] Collection to store aggregation of ChildProfileResource objects.
*/
protected $collGroupResources;
protected $collGroupResourcesPartial;
protected $collProfileResources;
protected $collProfileResourcesPartial;
/**
* @var ObjectCollection|ChildResourceI18n[] Collection to store aggregation of ChildResourceI18n objects.
@@ -98,9 +98,9 @@ abstract class Resource implements ActiveRecordInterface
protected $collResourceI18nsPartial;
/**
* @var ChildGroup[] Collection to store aggregation of ChildGroup objects.
* @var ChildProfile[] Collection to store aggregation of ChildProfile objects.
*/
protected $collGroups;
protected $collProfiles;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -128,13 +128,13 @@ abstract class Resource implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $groupsScheduledForDeletion = null;
protected $profilesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $groupResourcesScheduledForDeletion = null;
protected $profileResourcesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -669,11 +669,11 @@ abstract class Resource implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects?
$this->collGroupResources = null;
$this->collProfileResources = null;
$this->collResourceI18ns = null;
$this->collGroups = null;
$this->collProfiles = null;
} // if (deep)
}
@@ -807,44 +807,44 @@ abstract class Resource implements ActiveRecordInterface
$this->resetModified();
}
if ($this->groupsScheduledForDeletion !== null) {
if (!$this->groupsScheduledForDeletion->isEmpty()) {
if ($this->profilesScheduledForDeletion !== null) {
if (!$this->profilesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->groupsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
foreach ($this->profilesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
GroupResourceQuery::create()
ProfileResourceQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->groupsScheduledForDeletion = null;
$this->profilesScheduledForDeletion = null;
}
foreach ($this->getGroups() as $group) {
if ($group->isModified()) {
$group->save($con);
foreach ($this->getProfiles() as $profile) {
if ($profile->isModified()) {
$profile->save($con);
}
}
} elseif ($this->collGroups) {
foreach ($this->collGroups as $group) {
if ($group->isModified()) {
$group->save($con);
} elseif ($this->collProfiles) {
foreach ($this->collProfiles as $profile) {
if ($profile->isModified()) {
$profile->save($con);
}
}
}
if ($this->groupResourcesScheduledForDeletion !== null) {
if (!$this->groupResourcesScheduledForDeletion->isEmpty()) {
\Thelia\Model\GroupResourceQuery::create()
->filterByPrimaryKeys($this->groupResourcesScheduledForDeletion->getPrimaryKeys(false))
if ($this->profileResourcesScheduledForDeletion !== null) {
if (!$this->profileResourcesScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProfileResourceQuery::create()
->filterByPrimaryKeys($this->profileResourcesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->groupResourcesScheduledForDeletion = null;
$this->profileResourcesScheduledForDeletion = null;
}
}
if ($this->collGroupResources !== null) {
foreach ($this->collGroupResources as $referrerFK) {
if ($this->collProfileResources !== null) {
foreach ($this->collProfileResources as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1043,8 +1043,8 @@ abstract class Resource implements ActiveRecordInterface
}
if ($includeForeignObjects) {
if (null !== $this->collGroupResources) {
$result['GroupResources'] = $this->collGroupResources->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
if (null !== $this->collProfileResources) {
$result['ProfileResources'] = $this->collProfileResources->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collResourceI18ns) {
$result['ResourceI18ns'] = $this->collResourceI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
@@ -1210,9 +1210,9 @@ abstract class Resource implements ActiveRecordInterface
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
foreach ($this->getGroupResources() as $relObj) {
foreach ($this->getProfileResources() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addGroupResource($relObj->copy($deepCopy));
$copyObj->addProfileResource($relObj->copy($deepCopy));
}
}
@@ -1263,8 +1263,8 @@ abstract class Resource implements ActiveRecordInterface
*/
public function initRelation($relationName)
{
if ('GroupResource' == $relationName) {
return $this->initGroupResources();
if ('ProfileResource' == $relationName) {
return $this->initProfileResources();
}
if ('ResourceI18n' == $relationName) {
return $this->initResourceI18ns();
@@ -1272,31 +1272,31 @@ abstract class Resource implements ActiveRecordInterface
}
/**
* Clears out the collGroupResources collection
* Clears out the collProfileResources 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 addGroupResources()
* @see addProfileResources()
*/
public function clearGroupResources()
public function clearProfileResources()
{
$this->collGroupResources = null; // important to set this to NULL since that means it is uninitialized
$this->collProfileResources = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collGroupResources collection loaded partially.
* Reset is the collProfileResources collection loaded partially.
*/
public function resetPartialGroupResources($v = true)
public function resetPartialProfileResources($v = true)
{
$this->collGroupResourcesPartial = $v;
$this->collProfileResourcesPartial = $v;
}
/**
* Initializes the collGroupResources collection.
* Initializes the collProfileResources collection.
*
* By default this just sets the collGroupResources collection to an empty array (like clearcollGroupResources());
* By default this just sets the collProfileResources collection to an empty array (like clearcollProfileResources());
* 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.
*
@@ -1305,17 +1305,17 @@ abstract class Resource implements ActiveRecordInterface
*
* @return void
*/
public function initGroupResources($overrideExisting = true)
public function initProfileResources($overrideExisting = true)
{
if (null !== $this->collGroupResources && !$overrideExisting) {
if (null !== $this->collProfileResources && !$overrideExisting) {
return;
}
$this->collGroupResources = new ObjectCollection();
$this->collGroupResources->setModel('\Thelia\Model\GroupResource');
$this->collProfileResources = new ObjectCollection();
$this->collProfileResources->setModel('\Thelia\Model\ProfileResource');
}
/**
* Gets an array of ChildGroupResource objects which contain a foreign key that references this object.
* Gets an array of ChildProfileResource 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.
@@ -1325,112 +1325,112 @@ abstract class Resource implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildGroupResource[] List of ChildGroupResource objects
* @return Collection|ChildProfileResource[] List of ChildProfileResource objects
* @throws PropelException
*/
public function getGroupResources($criteria = null, ConnectionInterface $con = null)
public function getProfileResources($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collGroupResourcesPartial && !$this->isNew();
if (null === $this->collGroupResources || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collGroupResources) {
$partial = $this->collProfileResourcesPartial && !$this->isNew();
if (null === $this->collProfileResources || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collProfileResources) {
// return empty collection
$this->initGroupResources();
$this->initProfileResources();
} else {
$collGroupResources = ChildGroupResourceQuery::create(null, $criteria)
$collProfileResources = ChildProfileResourceQuery::create(null, $criteria)
->filterByResource($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collGroupResourcesPartial && count($collGroupResources)) {
$this->initGroupResources(false);
if (false !== $this->collProfileResourcesPartial && count($collProfileResources)) {
$this->initProfileResources(false);
foreach ($collGroupResources as $obj) {
if (false == $this->collGroupResources->contains($obj)) {
$this->collGroupResources->append($obj);
foreach ($collProfileResources as $obj) {
if (false == $this->collProfileResources->contains($obj)) {
$this->collProfileResources->append($obj);
}
}
$this->collGroupResourcesPartial = true;
$this->collProfileResourcesPartial = true;
}
$collGroupResources->getInternalIterator()->rewind();
$collProfileResources->getInternalIterator()->rewind();
return $collGroupResources;
return $collProfileResources;
}
if ($partial && $this->collGroupResources) {
foreach ($this->collGroupResources as $obj) {
if ($partial && $this->collProfileResources) {
foreach ($this->collProfileResources as $obj) {
if ($obj->isNew()) {
$collGroupResources[] = $obj;
$collProfileResources[] = $obj;
}
}
}
$this->collGroupResources = $collGroupResources;
$this->collGroupResourcesPartial = false;
$this->collProfileResources = $collProfileResources;
$this->collProfileResourcesPartial = false;
}
}
return $this->collGroupResources;
return $this->collProfileResources;
}
/**
* Sets a collection of GroupResource objects related by a one-to-many relationship
* Sets a collection of ProfileResource 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 $groupResources A Propel collection.
* @param Collection $profileResources A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildResource The current object (for fluent API support)
*/
public function setGroupResources(Collection $groupResources, ConnectionInterface $con = null)
public function setProfileResources(Collection $profileResources, ConnectionInterface $con = null)
{
$groupResourcesToDelete = $this->getGroupResources(new Criteria(), $con)->diff($groupResources);
$profileResourcesToDelete = $this->getProfileResources(new Criteria(), $con)->diff($profileResources);
//since at least one column in the foreign key is at the same time a PK
//we can not just set a PK to NULL in the lines below. We have to store
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
$this->groupResourcesScheduledForDeletion = clone $groupResourcesToDelete;
$this->profileResourcesScheduledForDeletion = clone $profileResourcesToDelete;
foreach ($groupResourcesToDelete as $groupResourceRemoved) {
$groupResourceRemoved->setResource(null);
foreach ($profileResourcesToDelete as $profileResourceRemoved) {
$profileResourceRemoved->setResource(null);
}
$this->collGroupResources = null;
foreach ($groupResources as $groupResource) {
$this->addGroupResource($groupResource);
$this->collProfileResources = null;
foreach ($profileResources as $profileResource) {
$this->addProfileResource($profileResource);
}
$this->collGroupResources = $groupResources;
$this->collGroupResourcesPartial = false;
$this->collProfileResources = $profileResources;
$this->collProfileResourcesPartial = false;
return $this;
}
/**
* Returns the number of related GroupResource objects.
* Returns the number of related ProfileResource objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related GroupResource objects.
* @return int Count of related ProfileResource objects.
* @throws PropelException
*/
public function countGroupResources(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countProfileResources(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collGroupResourcesPartial && !$this->isNew();
if (null === $this->collGroupResources || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collGroupResources) {
$partial = $this->collProfileResourcesPartial && !$this->isNew();
if (null === $this->collProfileResources || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collProfileResources) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getGroupResources());
return count($this->getProfileResources());
}
$query = ChildGroupResourceQuery::create(null, $criteria);
$query = ChildProfileResourceQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1440,53 +1440,53 @@ abstract class Resource implements ActiveRecordInterface
->count($con);
}
return count($this->collGroupResources);
return count($this->collProfileResources);
}
/**
* Method called to associate a ChildGroupResource object to this object
* through the ChildGroupResource foreign key attribute.
* Method called to associate a ChildProfileResource object to this object
* through the ChildProfileResource foreign key attribute.
*
* @param ChildGroupResource $l ChildGroupResource
* @param ChildProfileResource $l ChildProfileResource
* @return \Thelia\Model\Resource The current object (for fluent API support)
*/
public function addGroupResource(ChildGroupResource $l)
public function addProfileResource(ChildProfileResource $l)
{
if ($this->collGroupResources === null) {
$this->initGroupResources();
$this->collGroupResourcesPartial = true;
if ($this->collProfileResources === null) {
$this->initProfileResources();
$this->collProfileResourcesPartial = true;
}
if (!in_array($l, $this->collGroupResources->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddGroupResource($l);
if (!in_array($l, $this->collProfileResources->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddProfileResource($l);
}
return $this;
}
/**
* @param GroupResource $groupResource The groupResource object to add.
* @param ProfileResource $profileResource The profileResource object to add.
*/
protected function doAddGroupResource($groupResource)
protected function doAddProfileResource($profileResource)
{
$this->collGroupResources[]= $groupResource;
$groupResource->setResource($this);
$this->collProfileResources[]= $profileResource;
$profileResource->setResource($this);
}
/**
* @param GroupResource $groupResource The groupResource object to remove.
* @param ProfileResource $profileResource The profileResource object to remove.
* @return ChildResource The current object (for fluent API support)
*/
public function removeGroupResource($groupResource)
public function removeProfileResource($profileResource)
{
if ($this->getGroupResources()->contains($groupResource)) {
$this->collGroupResources->remove($this->collGroupResources->search($groupResource));
if (null === $this->groupResourcesScheduledForDeletion) {
$this->groupResourcesScheduledForDeletion = clone $this->collGroupResources;
$this->groupResourcesScheduledForDeletion->clear();
if ($this->getProfileResources()->contains($profileResource)) {
$this->collProfileResources->remove($this->collProfileResources->search($profileResource));
if (null === $this->profileResourcesScheduledForDeletion) {
$this->profileResourcesScheduledForDeletion = clone $this->collProfileResources;
$this->profileResourcesScheduledForDeletion->clear();
}
$this->groupResourcesScheduledForDeletion[]= clone $groupResource;
$groupResource->setResource(null);
$this->profileResourcesScheduledForDeletion[]= clone $profileResource;
$profileResource->setResource(null);
}
return $this;
@@ -1498,7 +1498,7 @@ abstract class Resource implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Resource is new, it will return
* an empty collection; or if this Resource has previously
* been saved, it will retrieve related GroupResources from storage.
* been saved, it will retrieve related ProfileResources from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -1507,14 +1507,14 @@ abstract class Resource implements ActiveRecordInterface
* @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|ChildGroupResource[] List of ChildGroupResource objects
* @return Collection|ChildProfileResource[] List of ChildProfileResource objects
*/
public function getGroupResourcesJoinGroup($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
public function getProfileResourcesJoinProfile($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildGroupResourceQuery::create(null, $criteria);
$query->joinWith('Group', $joinBehavior);
$query = ChildProfileResourceQuery::create(null, $criteria);
$query->joinWith('Profile', $joinBehavior);
return $this->getGroupResources($query, $con);
return $this->getProfileResources($query, $con);
}
/**
@@ -1743,38 +1743,38 @@ abstract class Resource implements ActiveRecordInterface
}
/**
* Clears out the collGroups collection
* Clears out the collProfiles 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 addGroups()
* @see addProfiles()
*/
public function clearGroups()
public function clearProfiles()
{
$this->collGroups = null; // important to set this to NULL since that means it is uninitialized
$this->collGroupsPartial = null;
$this->collProfiles = null; // important to set this to NULL since that means it is uninitialized
$this->collProfilesPartial = null;
}
/**
* Initializes the collGroups collection.
* Initializes the collProfiles collection.
*
* By default this just sets the collGroups collection to an empty collection (like clearGroups());
* By default this just sets the collProfiles collection to an empty collection (like clearProfiles());
* 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.
*
* @return void
*/
public function initGroups()
public function initProfiles()
{
$this->collGroups = new ObjectCollection();
$this->collGroups->setModel('\Thelia\Model\Group');
$this->collProfiles = new ObjectCollection();
$this->collProfiles->setModel('\Thelia\Model\Profile');
}
/**
* Gets a collection of ChildGroup objects related by a many-to-many relationship
* to the current object by way of the group_resource cross-reference table.
* Gets a collection of ChildProfile objects related by a many-to-many relationship
* to the current object by way of the profile_resource cross-reference table.
*
* 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.
@@ -1785,73 +1785,73 @@ abstract class Resource implements ActiveRecordInterface
* @param Criteria $criteria Optional query object to filter the query
* @param ConnectionInterface $con Optional connection object
*
* @return ObjectCollection|ChildGroup[] List of ChildGroup objects
* @return ObjectCollection|ChildProfile[] List of ChildProfile objects
*/
public function getGroups($criteria = null, ConnectionInterface $con = null)
public function getProfiles($criteria = null, ConnectionInterface $con = null)
{
if (null === $this->collGroups || null !== $criteria) {
if ($this->isNew() && null === $this->collGroups) {
if (null === $this->collProfiles || null !== $criteria) {
if ($this->isNew() && null === $this->collProfiles) {
// return empty collection
$this->initGroups();
$this->initProfiles();
} else {
$collGroups = ChildGroupQuery::create(null, $criteria)
$collProfiles = ChildProfileQuery::create(null, $criteria)
->filterByResource($this)
->find($con);
if (null !== $criteria) {
return $collGroups;
return $collProfiles;
}
$this->collGroups = $collGroups;
$this->collProfiles = $collProfiles;
}
}
return $this->collGroups;
return $this->collProfiles;
}
/**
* Sets a collection of Group objects related by a many-to-many relationship
* to the current object by way of the group_resource cross-reference table.
* Sets a collection of Profile objects related by a many-to-many relationship
* to the current object by way of the profile_resource cross-reference table.
* 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 $groups A Propel collection.
* @param Collection $profiles A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildResource The current object (for fluent API support)
*/
public function setGroups(Collection $groups, ConnectionInterface $con = null)
public function setProfiles(Collection $profiles, ConnectionInterface $con = null)
{
$this->clearGroups();
$currentGroups = $this->getGroups();
$this->clearProfiles();
$currentProfiles = $this->getProfiles();
$this->groupsScheduledForDeletion = $currentGroups->diff($groups);
$this->profilesScheduledForDeletion = $currentProfiles->diff($profiles);
foreach ($groups as $group) {
if (!$currentGroups->contains($group)) {
$this->doAddGroup($group);
foreach ($profiles as $profile) {
if (!$currentProfiles->contains($profile)) {
$this->doAddProfile($profile);
}
}
$this->collGroups = $groups;
$this->collProfiles = $profiles;
return $this;
}
/**
* Gets the number of ChildGroup objects related by a many-to-many relationship
* to the current object by way of the group_resource cross-reference table.
* Gets the number of ChildProfile objects related by a many-to-many relationship
* to the current object by way of the profile_resource cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param ConnectionInterface $con Optional connection object
*
* @return int the number of related ChildGroup objects
* @return int the number of related ChildProfile objects
*/
public function countGroups($criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countProfiles($criteria = null, $distinct = false, ConnectionInterface $con = null)
{
if (null === $this->collGroups || null !== $criteria) {
if ($this->isNew() && null === $this->collGroups) {
if (null === $this->collProfiles || null !== $criteria) {
if ($this->isNew() && null === $this->collProfiles) {
return 0;
} else {
$query = ChildGroupQuery::create(null, $criteria);
$query = ChildProfileQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1861,65 +1861,65 @@ abstract class Resource implements ActiveRecordInterface
->count($con);
}
} else {
return count($this->collGroups);
return count($this->collProfiles);
}
}
/**
* Associate a ChildGroup object to this object
* through the group_resource cross reference table.
* Associate a ChildProfile object to this object
* through the profile_resource cross reference table.
*
* @param ChildGroup $group The ChildGroupResource object to relate
* @param ChildProfile $profile The ChildProfileResource object to relate
* @return ChildResource The current object (for fluent API support)
*/
public function addGroup(ChildGroup $group)
public function addProfile(ChildProfile $profile)
{
if ($this->collGroups === null) {
$this->initGroups();
if ($this->collProfiles === null) {
$this->initProfiles();
}
if (!$this->collGroups->contains($group)) { // only add it if the **same** object is not already associated
$this->doAddGroup($group);
$this->collGroups[] = $group;
if (!$this->collProfiles->contains($profile)) { // only add it if the **same** object is not already associated
$this->doAddProfile($profile);
$this->collProfiles[] = $profile;
}
return $this;
}
/**
* @param Group $group The group object to add.
* @param Profile $profile The profile object to add.
*/
protected function doAddGroup($group)
protected function doAddProfile($profile)
{
$groupResource = new ChildGroupResource();
$groupResource->setGroup($group);
$this->addGroupResource($groupResource);
$profileResource = new ChildProfileResource();
$profileResource->setProfile($profile);
$this->addProfileResource($profileResource);
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
if (!$group->getResources()->contains($this)) {
$foreignCollection = $group->getResources();
if (!$profile->getResources()->contains($this)) {
$foreignCollection = $profile->getResources();
$foreignCollection[] = $this;
}
}
/**
* Remove a ChildGroup object to this object
* through the group_resource cross reference table.
* Remove a ChildProfile object to this object
* through the profile_resource cross reference table.
*
* @param ChildGroup $group The ChildGroupResource object to relate
* @param ChildProfile $profile The ChildProfileResource object to relate
* @return ChildResource The current object (for fluent API support)
*/
public function removeGroup(ChildGroup $group)
public function removeProfile(ChildProfile $profile)
{
if ($this->getGroups()->contains($group)) {
$this->collGroups->remove($this->collGroups->search($group));
if ($this->getProfiles()->contains($profile)) {
$this->collProfiles->remove($this->collProfiles->search($profile));
if (null === $this->groupsScheduledForDeletion) {
$this->groupsScheduledForDeletion = clone $this->collGroups;
$this->groupsScheduledForDeletion->clear();
if (null === $this->profilesScheduledForDeletion) {
$this->profilesScheduledForDeletion = clone $this->collProfiles;
$this->profilesScheduledForDeletion->clear();
}
$this->groupsScheduledForDeletion[] = $group;
$this->profilesScheduledForDeletion[] = $profile;
}
return $this;
@@ -1953,8 +1953,8 @@ abstract class Resource implements ActiveRecordInterface
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($this->collGroupResources) {
foreach ($this->collGroupResources as $o) {
if ($this->collProfileResources) {
foreach ($this->collProfileResources as $o) {
$o->clearAllReferences($deep);
}
}
@@ -1963,8 +1963,8 @@ abstract class Resource implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collGroups) {
foreach ($this->collGroups as $o) {
if ($this->collProfiles) {
foreach ($this->collProfiles as $o) {
$o->clearAllReferences($deep);
}
}
@@ -1974,18 +1974,18 @@ abstract class Resource implements ActiveRecordInterface
$this->currentLocale = 'en_US';
$this->currentTranslations = null;
if ($this->collGroupResources instanceof Collection) {
$this->collGroupResources->clearIterator();
if ($this->collProfileResources instanceof Collection) {
$this->collProfileResources->clearIterator();
}
$this->collGroupResources = null;
$this->collProfileResources = null;
if ($this->collResourceI18ns instanceof Collection) {
$this->collResourceI18ns->clearIterator();
}
$this->collResourceI18ns = null;
if ($this->collGroups instanceof Collection) {
$this->collGroups->clearIterator();
if ($this->collProfiles instanceof Collection) {
$this->collProfiles->clearIterator();
}
$this->collGroups = null;
$this->collProfiles = null;
}
/**

View File

@@ -36,9 +36,9 @@ use Thelia\Model\Map\ResourceTableMap;
* @method ChildResourceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildResourceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildResourceQuery leftJoinGroupResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupResource relation
* @method ChildResourceQuery rightJoinGroupResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupResource relation
* @method ChildResourceQuery innerJoinGroupResource($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupResource relation
* @method ChildResourceQuery leftJoinProfileResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProfileResource relation
* @method ChildResourceQuery rightJoinProfileResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProfileResource relation
* @method ChildResourceQuery innerJoinProfileResource($relationAlias = null) Adds a INNER JOIN clause to the query using the ProfileResource relation
*
* @method ChildResourceQuery leftJoinResourceI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ResourceI18n relation
* @method ChildResourceQuery rightJoinResourceI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ResourceI18n relation
@@ -390,40 +390,40 @@ abstract class ResourceQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\GroupResource object
* Filter the query by a related \Thelia\Model\ProfileResource object
*
* @param \Thelia\Model\GroupResource|ObjectCollection $groupResource the related object to use as filter
* @param \Thelia\Model\ProfileResource|ObjectCollection $profileResource the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildResourceQuery The current query, for fluid interface
*/
public function filterByGroupResource($groupResource, $comparison = null)
public function filterByProfileResource($profileResource, $comparison = null)
{
if ($groupResource instanceof \Thelia\Model\GroupResource) {
if ($profileResource instanceof \Thelia\Model\ProfileResource) {
return $this
->addUsingAlias(ResourceTableMap::ID, $groupResource->getResourceId(), $comparison);
} elseif ($groupResource instanceof ObjectCollection) {
->addUsingAlias(ResourceTableMap::ID, $profileResource->getResourceId(), $comparison);
} elseif ($profileResource instanceof ObjectCollection) {
return $this
->useGroupResourceQuery()
->filterByPrimaryKeys($groupResource->getPrimaryKeys())
->useProfileResourceQuery()
->filterByPrimaryKeys($profileResource->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByGroupResource() only accepts arguments of type \Thelia\Model\GroupResource or Collection');
throw new PropelException('filterByProfileResource() only accepts arguments of type \Thelia\Model\ProfileResource or Collection');
}
}
/**
* Adds a JOIN clause to the query using the GroupResource relation
* Adds a JOIN clause to the query using the ProfileResource relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildResourceQuery The current query, for fluid interface
*/
public function joinGroupResource($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinProfileResource($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('GroupResource');
$relationMap = $tableMap->getRelation('ProfileResource');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -438,14 +438,14 @@ abstract class ResourceQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'GroupResource');
$this->addJoinObject($join, 'ProfileResource');
}
return $this;
}
/**
* Use the GroupResource relation GroupResource object
* Use the ProfileResource relation ProfileResource object
*
* @see useQuery()
*
@@ -453,13 +453,13 @@ abstract class ResourceQuery extends ModelCriteria
* 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\GroupResourceQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\ProfileResourceQuery A secondary query class using the current class as primary query
*/
public function useGroupResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useProfileResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroupResource($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'GroupResource', '\Thelia\Model\GroupResourceQuery');
->joinProfileResource($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ProfileResource', '\Thelia\Model\ProfileResourceQuery');
}
/**
@@ -536,19 +536,19 @@ abstract class ResourceQuery extends ModelCriteria
}
/**
* Filter the query by a related Group object
* using the group_resource table as cross reference
* Filter the query by a related Profile object
* using the profile_resource table as cross reference
*
* @param Group $group the related object to use as filter
* @param Profile $profile the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildResourceQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = Criteria::EQUAL)
public function filterByProfile($profile, $comparison = Criteria::EQUAL)
{
return $this
->useGroupResourceQuery()
->filterByGroup($group, $comparison)
->useProfileResourceQuery()
->filterByProfile($profile, $comparison)
->endUse();
}