/**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database. In some cases you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by find*()
  * and findPk*() calls.
  *
  * @param \gossi\trixionary\model\SkillReference $obj A \gossi\trixionary\model\SkillReference object.
  * @param string $key             (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (null === $key) {
             $key = serialize(array((string) $obj->getSkillId(), (string) $obj->getReferenceId()));
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Beispiel #2
0
 /**
  * Remove skill of this object
  * through the kk_trixionary_skill_reference cross reference table.
  *
  * @param ChildSkill $skill
  * @return ChildReference The current object (for fluent API support)
  */
 public function removeSkill(ChildSkill $skill)
 {
     if ($this->getSkills()->contains($skill)) {
         $skillReference = new ChildSkillReference();
         $skillReference->setSkill($skill);
         if ($skill->isReferencesLoaded()) {
             //remove the back reference if available
             $skill->getReferences()->removeObject($this);
         }
         $skillReference->setReference($this);
         $this->removeSkillReference(clone $skillReference);
         $skillReference->clear();
         $this->collSkills->remove($this->collSkills->search($skill));
         if (null === $this->skillsScheduledForDeletion) {
             $this->skillsScheduledForDeletion = clone $this->collSkills;
             $this->skillsScheduledForDeletion->clear();
         }
         $this->skillsScheduledForDeletion->push($skill);
     }
     return $this;
 }
Beispiel #3
0
 /**
  * Filter the query by a related \gossi\trixionary\model\SkillReference object
  *
  * @param \gossi\trixionary\model\SkillReference|ObjectCollection $skillReference the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildReferenceQuery The current query, for fluid interface
  */
 public function filterBySkillReference($skillReference, $comparison = null)
 {
     if ($skillReference instanceof \gossi\trixionary\model\SkillReference) {
         return $this->addUsingAlias(ReferenceTableMap::COL_ID, $skillReference->getReferenceId(), $comparison);
     } elseif ($skillReference instanceof ObjectCollection) {
         return $this->useSkillReferenceQuery()->filterByPrimaryKeys($skillReference->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterBySkillReference() only accepts arguments of type \\gossi\\trixionary\\model\\SkillReference or Collection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   ChildSkillReference $skillReference Object to remove from the list of results
  *
  * @return $this|ChildSkillReferenceQuery The current query, for fluid interface
  */
 public function prune($skillReference = null)
 {
     if ($skillReference) {
         $this->addCond('pruneCond0', $this->getAliasedColName(SkillReferenceTableMap::COL_SKILL_ID), $skillReference->getSkillId(), Criteria::NOT_EQUAL);
         $this->addCond('pruneCond1', $this->getAliasedColName(SkillReferenceTableMap::COL_REFERENCE_ID), $skillReference->getReferenceId(), Criteria::NOT_EQUAL);
         $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
     }
     return $this;
 }