/** * Remove lyric of this object * through the lyric_language cross reference table. * * @param ChildLyric $lyric * @return ChildLanguage The current object (for fluent API support) */ public function removeLyric(ChildLyric $lyric) { if ($this->getLyrics()->contains($lyric)) { $lyricLanguage = new LyricLanguage(); $lyricLanguage->setLyric($lyric); if ($lyric->isLanguagesLoaded()) { //remove the back reference if available $lyric->getLanguages()->removeObject($this); } $lyricLanguage->setLanguage($this); $this->removeLyricLanguage(clone $lyricLanguage); $lyricLanguage->clear(); $this->collLyrics->remove($this->collLyrics->search($lyric)); if (null === $this->lyricsScheduledForDeletion) { $this->lyricsScheduledForDeletion = clone $this->collLyrics; $this->lyricsScheduledForDeletion->clear(); } $this->lyricsScheduledForDeletion->push($lyric); } return $this; }
/** * Filter the query by a related \Tekstove\ApiBundle\Model\Lyric\LyricLanguage object * * @param \Tekstove\ApiBundle\Model\Lyric\LyricLanguage|ObjectCollection $lyricLanguage the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildLanguageQuery The current query, for fluid interface */ public function filterByLyricLanguage($lyricLanguage, $comparison = null) { if ($lyricLanguage instanceof \Tekstove\ApiBundle\Model\Lyric\LyricLanguage) { return $this->addUsingAlias(LanguageTableMap::COL_ID, $lyricLanguage->getLanguageId(), $comparison); } elseif ($lyricLanguage instanceof ObjectCollection) { return $this->useLyricLanguageQuery()->filterByPrimaryKeys($lyricLanguage->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByLyricLanguage() only accepts arguments of type \\Tekstove\\ApiBundle\\Model\\Lyric\\LyricLanguage or Collection'); } }
/** * 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 \Tekstove\ApiBundle\Model\Lyric\LyricLanguage $obj A \Tekstove\ApiBundle\Model\Lyric\LyricLanguage 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([null === $obj->getLyricId() || is_scalar($obj->getLyricId()) || is_callable([$obj->getLyricId(), '__toString']) ? (string) $obj->getLyricId() : $obj->getLyricId(), null === $obj->getLanguageId() || is_scalar($obj->getLanguageId()) || is_callable([$obj->getLanguageId(), '__toString']) ? (string) $obj->getLanguageId() : $obj->getLanguageId()]); } // if key === null self::$instances[$key] = $obj; } }
/** * Exclude object from result * * @param ChildLyricLanguage $lyricLanguage Object to remove from the list of results * * @return $this|ChildLyricLanguageQuery The current query, for fluid interface */ public function prune($lyricLanguage = null) { if ($lyricLanguage) { $this->addCond('pruneCond0', $this->getAliasedColName(LyricLanguageTableMap::COL_LYRIC_ID), $lyricLanguage->getLyricId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(LyricLanguageTableMap::COL_LANGUAGE_ID), $lyricLanguage->getLanguageId(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } return $this; }