本文整理汇总了PHP中Category::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getId方法的具体用法?PHP Category::getId怎么用?PHP Category::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clickCategoryFilterLink
/**
* @param Category $category
*/
public function clickCategoryFilterLink($category)
{
$elt = $this->getElement('Categories tree')->find('css', sprintf('#node_%s a', $category->getId()));
if (!$elt) {
throw new \Exception(sprintf('Could not find category filter "%s".', $category->getId()));
}
$elt->click();
}
示例2: getBudgetArticleByCategory
public function getBudgetArticleByCategory(Category $category)
{
if (isset($this->_budgetArticles[$category->getId()])) {
return $this->_budgetArticles[$category->getId()];
}
$budgetArticle = new BudgetCategory();
$this->_budgetArticles[$category->getId()] = $budgetArticle;
$budgetArticle->setCategory($category);
$budgetArticle->setType($category->getType() == Category::TYPE_PROFIT ? BudgetCategory::TYPE_PROFIT : BudgetCategory::TYPE_EXPENSE);
$budgetArticle->setUser($this->_user);
$budgetArticle->setDateStart($this->_startDate->format('Y-m-d'));
return $budgetArticle;
}
示例3: update
public function update(Category $category)
{
if ($this->find($category->getId())) {
$catId = $category->getId();
$userId = $category->getUser()->getId();
$superCat = $category->getParentCategory()->getId();
$subCat = $category->getSubCategory();
$sql = "UPDATE " . $this->TABLE_NAME . " SET\n userId='{$userId}',superCategory='{$superCat}',subCategory='{$subCat}'\n WHERE id='{$catId}'";
if (mysql_query($sql, $this->connection)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例4: Category
function test_getId()
{
$name = "Work stuff";
$id = 1;
$test_Category = new Category($name, $id);
$result = $test_Category->getId();
$this->assertEquals(true, is_numeric($result));
}
示例5: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCategory !== null && $this->thelia_category_id !== $this->aCategory->getId()) {
$this->aCategory = null;
}
if ($this->aLang !== null && $this->lang_id !== $this->aLang->getId()) {
$this->aLang = null;
}
}
示例6: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) {
$this->aCategory = null;
}
if ($this->aTaxRule !== null && $this->tax_rule_id !== $this->aTaxRule->getId()) {
$this->aTaxRule = null;
}
}
示例7: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) {
$this->aCategory = null;
}
if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) {
$this->aAttribute = null;
}
}
示例8: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) {
$this->aCategory = null;
}
if ($this->aFeature !== null && $this->feature_id !== $this->aFeature->getId()) {
$this->aFeature = null;
}
}
示例9: getAllCategoriesFromDatabase
public static function getAllCategoriesFromDatabase($dbConn)
{
$categoryIds = readFromDatabase::readEntireColumnFromTable($dbConn, array(self::ID_COLUMN_NAME), self::TABLE_NAME);
$categories = array();
foreach ($categoryIds as $categoryId) {
$category = new Category($dbConn, $categoryId[self::ID_COLUMN_NAME]);
$categories[$category->getId()] = $category->getName();
}
return $categories;
}
示例10: Category
function test_getId()
{
//Arrange
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
//Act
$result = $test_category->getId();
//Assert
$this->assertEquals(true, is_numeric($result));
}
示例11: insert
public function insert(Category $category, Subcategory $subcategory, Brand $brand, Item $item)
{
// $sql = "INSERT INTO item values (null, 'aalluu', 'asdfasd',true,true, '2015-10-10','asdfasf', 'asdfasd', 1, 1 ,1, 1)";
$sql = "INSERT INTO item values (null, '" . $item->getTitle() . "','" . $item->getDetail() . "',true,false, '" . $item->getDate() . "', '" . $item->getLocation() . "','asfasf'," . $category->getId() . "," . $subcategory->getId() . ", 1 ," . $brand->getId() . ")";
echo $sql;
if ($this->conn->query($sql) === TRUE) {
echo "Insert operation successful";
} else {
echo "Error inserting: ";
}
}
示例12: Category
function test_find()
{
$name = "Wash the dog";
$name2 = "Home stuff";
$test_Category = new Category($name);
$test_Category->save();
$test_Category2 = new Category($name2);
$test_Category2->save();
$result = Category::find($test_Category->getId());
$this->assertEquals($test_Category, $result);
}
示例13: edit
public function edit(User $currentUser, Category $category)
{
$id = intval($category->getId());
$name = $this->database->quote($category->getName());
$description = $this->database->quote($category->getDescription());
$query = "UPDATE category SET name = '" . $name . "', description = '" . $description . "' WHERE id = " . $id;
$result = $this->database->exec($query);
if ($result) {
return true;
} else {
throw new Exception("Catastrophe base de données.");
}
}
示例14: serialize
/**
* (non-PHPdoc)
* @see de\RaumZeitLabor\PartKeepr\Util.Serializable::serialize()
*/
public function serialize () {
$aManufacturers = array();
foreach ($this->getManufacturers() as $manufacturer) {
$aManufacturers[] = $manufacturer->serialize();
}
$aDistributors = array();
foreach ($this->getDistributors() as $distributor) {
$aDistributors[] = $distributor->serialize();
}
$aParameters = array();
foreach ($this->getParameters() as $parameter) {
$aParameters[] = $parameter->serialize();
}
$aImages = array();
foreach ($this->getImages() as $image) {
$aImages[] = $image->serialize();
}
$aAttachments = array();
foreach ($this->getAttachments() as $attachment) {
$aAttachments[] = $attachment->serialize();
}
return array(
"id" => $this->getId(),
"name" => $this->getName(),
"comment" => $this->getComment(),
"stockLevel" => $this->getStockLevel(),
"footprint_id" => is_object($this->footprint) ? $this->footprint->getId() : null,
"minStockLevel" => $this->minStockLevel,
"storageLocation_id" => is_object($this->storageLocation) ? $this->storageLocation->getId() : null,
"storageLocationName" => is_object($this->storageLocation) ? $this->storageLocation->getName() : null,
"category_id" => is_object($this->category) ? $this->category->getId() : null,
"partUnit_id" => is_object($this->partUnit) ? $this->getPartUnit()->getId() : null,
"partUnit_name" => is_object($this->partUnit) ? $this->getPartUnit()->getId() : PartKeepr::i18n("Pieces"),
"partUnit_shortName" => is_object($this->partUnit) ? $this->getPartUnit()->getId() : "",
"manufacturers" => $aManufacturers,
"distributors" => $aDistributors,
"images" => $aImages,
"attachments" => $aAttachments,
"parameters" => $aParameters
);
}
示例15: Category
function test_save()
{
//Arrange
$name = "Home stuff";
$id = null;
$test_category = new Category($name, $id);
$test_category->save();
$due_date = "2015-10-12";
$description = "Wash the dog";
$category_id = $test_category->getId();
$test_task = new Task($description, $due_date, $id, $category_id);
//Act
$test_task->save();
//Assert
$result = Task::getAll();
var_dump($result);
$this->assertEquals($test_task, $result[0]);
}