Skip to content

Commit

Permalink
phpdoc (#29481)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibdrev committed Apr 27, 2024
1 parent 0312aae commit 30b9b71
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions htdocs/variants/class/ProductAttribute.class.php
Expand Up @@ -18,11 +18,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/**
* \file htdocs/variants/class/ProductAttribute.class.php
* \ingroup variants
* \brief File of the ProductAttribute class
*/

require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';

/**
* Class ProductAttribute
* Used to represent a product attribute
* Used to represent a Product attribute
* Examples:
* - Attribute 'color' (of type ProductAttribute) with values 'white', 'blue' or 'red' (each of type ProductAttributeValue).
* - Attribute 'size' (of type ProductAttribute) with values 'S', 'L' or 'XL' (each of type ProductAttributeValue).
*/
class ProductAttribute extends CommonObject
{
Expand All @@ -31,6 +40,7 @@ class ProductAttribute extends CommonObject
* @var DoliDB
*/
public $db;

/**
* @var string ID of module.
*/
Expand Down Expand Up @@ -144,6 +154,7 @@ class ProductAttribute extends CommonObject
* @var ProductAttributeValue[]
*/
public $lines = array();

/**
* @var ProductAttributeValue
*/
Expand Down Expand Up @@ -326,7 +337,7 @@ public function fetch($id)
}

/**
* Returns an array of all product variants
* Returns an array with all the ProductAttribute objects of a given entity
*
* @return ProductAttribute[]
*/
Expand Down Expand Up @@ -366,9 +377,9 @@ public function fetchAll()
/**
* Updates a product attribute
*
* @param User $user Object user
* @param int $notrigger Do not execute trigger
* @return int Return integer <0 KO, >0 OK
* @param User $user User who updates the attribute
* @param 0|1 $notrigger 1 = Do not execute trigger (0 by default)
* @return int<min,-1>|1 <0 if KO, 1 if OK
*/
public function update(User $user, $notrigger = 0)
{
Expand Down Expand Up @@ -782,9 +793,9 @@ public function countChildValues()
}

/**
* Returns the number of products that are using this attribute
* Return the number of product variants using this attribute
*
* @return int
* @return int<-1,max> -1 if K0, nb of variants using this attribute
*/
public function countChildProducts()
{
Expand All @@ -793,7 +804,7 @@ public function countChildProducts()
$count = 0;

// Clean parameters
$this->id = $this->id > 0 ? $this->id : 0;
$this->id = ($this->id > 0) ? $this->id : 0;

// Check parameters
if (empty($this->id)) {
Expand Down Expand Up @@ -827,9 +838,9 @@ public function countChildProducts()
}

/**
* Test if used by a product
* Test if this attribute is used by a Product
*
* @return int Return integer <0 KO, =0 if No, =1 if Yes
* @return -1|0|1 Return -1 if KO, 0 if not used, 1 if used
*/
public function isUsed()
{
Expand Down

0 comments on commit 30b9b71

Please sign in to comment.