/** * @param ChildCategory $category The ChildCategory object to add. */ protected function doAddCategory(ChildCategory $category) { $this->collCategories[] = $category; $category->setFile($this); }
/** * Filter the query by a related \App\Propel\Category object * * @param \App\Propel\Category|ObjectCollection $category 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 filterByCategory($category, $comparison = null) { if ($category instanceof \App\Propel\Category) { return $this->addUsingAlias(ResourceTableMap::COL_RESOURCE_ID, $category->getResourceId(), $comparison); } elseif ($category instanceof ObjectCollection) { return $this->useCategoryQuery()->filterByPrimaryKeys($category->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByCategory() only accepts arguments of type \\App\\Propel\\Category or Collection'); } }
/** * Moves current node and its subtree to be the next sibling of $sibling * The modifications in the current object and the tree are immediate * * @param ChildCategory $sibling Propel object for sibling node * @param ConnectionInterface $con Connection to use. * * @return $this|ChildCategory The current Propel object */ public function moveToNextSiblingOf(ChildCategory $sibling, ConnectionInterface $con = null) { if (!$this->isInTree()) { throw new PropelException('A ChildCategory object must be already in the tree to be moved. Use the insertAsNextSiblingOf() instead.'); } if ($sibling->isRoot()) { throw new PropelException('Cannot move to next sibling of a root node.'); } if ($sibling->isDescendantOf($this)) { throw new PropelException('Cannot move a node as sibling of one of its subtree nodes.'); } $this->moveSubtreeTo($sibling->getRightValue() + 1, $sibling->getLevel() - $this->getLevel(), $con); return $this; }
/** * Reload all already loaded nodes to sync them with updated db * * @param ChildCategory $prune Object to prune from the update * @param ConnectionInterface $con Connection to use. */ public static function updateLoadedNodes($prune = null, ConnectionInterface $con = null) { if (Propel::isInstancePoolingEnabled()) { $keys = array(); /** @var $obj ChildCategory */ foreach (CategoryTableMap::$instances as $obj) { if (!$prune || !$prune->equals($obj)) { $keys[] = $obj->getPrimaryKey(); } } if (!empty($keys)) { // We don't need to alter the object instance pool; we're just modifying these ones // already in the pool. $criteria = new Criteria(CategoryTableMap::DATABASE_NAME); $criteria->add(CategoryTableMap::COL_CATEGORY_ID, $keys, Criteria::IN); $dataFetcher = ChildCategoryQuery::create(null, $criteria)->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); while ($row = $dataFetcher->fetch()) { $key = CategoryTableMap::getPrimaryKeyHashFromRow($row, 0); /** @var $object ChildCategory */ if (null !== ($object = CategoryTableMap::getInstanceFromPool($key))) { $object->setLeftValue($row[7]); $object->setRightValue($row[8]); $object->setLevel($row[9]); $object->clearNestedSetChildren(); } } $dataFetcher->close(); } } }
/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aCategory) { $this->aCategory->removeProduct($this); } if (null !== $this->aProvider) { $this->aProvider->removeProduct($this); } if (null !== $this->aUnit) { $this->aUnit->removeProduct($this); } if (null !== $this->aFile) { $this->aFile->removeProduct($this); } if (null !== $this->aResource) { $this->aResource->removeProduct($this); } $this->product_id = null; $this->resource_id = null; $this->product_name = null; $this->product_description = null; $this->category_id = null; $this->provider_id = null; $this->unit_id = null; $this->product_range = null; $this->product_price = null; $this->product_is_active = null; $this->product_pic = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }