コード例 #1
0
ファイル: merchandiseDao.php プロジェクト: Wooddu/MMNZ
 public function save(Merchandise $merchandise)
 {
     if ($merchandise->getItem_id() !== null) {
         $this->update($merchandise);
     } else {
         $this->insert($merchandise);
     }
 }
コード例 #2
0
ファイル: merchandiseValidator.php プロジェクト: Wooddu/MMNZ
 public static function validate(Merchandise $merchandise)
 {
     $errors = array();
     if (!trim($merchandise->getItem_name())) {
         $errors[] = new Error('item_name', 'Name cannot be empty.');
     } elseif (!trim($merchandise->getItem_price())) {
         $errors[] = new Error('item_price', 'Price cannot be empty');
     } elseif (!trim($merchandise->getOriginal_url())) {
         $errors[] = new Error('original_url', 'URL cannot be empty');
     } elseif (!trim($merchandise->getImg_url())) {
         $errors[] = new Error('img_url', 'Image cannot be empty');
     } elseif (!trim($merchandise->getCompany_id())) {
         $errors[] = new Error('company_id', 'Company cannot be empty');
     }
     return $errors;
 }
コード例 #3
0
ファイル: merchandiseMapper.php プロジェクト: Wooddu/MMNZ
 public static function map(Merchandise $merchandise, array $properties)
 {
     if (array_key_exists('item_id', $properties)) {
         $merchandise->setItem_id((int) $properties['item_id']);
     }
     if (array_key_exists('item_name', $properties)) {
         $merchandise->setItem_name($properties['item_name']);
     }
     if (array_key_exists('item_price', $properties)) {
         $merchandise->setItem_price((double) $properties['item_price']);
     }
     if (array_key_exists('original_url', $properties)) {
         $merchandise->setOriginal_url($properties['original_url']);
     }
     if (array_key_exists('img_url', $properties)) {
         $merchandise->setImg_url($properties['img_url']);
     }
     if (array_key_exists('company_id', $properties)) {
         $merchandise->setCompany_id((int) $properties['company_id']);
     }
 }
コード例 #4
0
ファイル: ProdTypes.php プロジェクト: best-nazar/gb-yii2
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMerchandises()
 {
     return $this->hasMany(Merchandise::className(), ['type' => 'id']);
 }
コード例 #5
0
ファイル: _merchandise.php プロジェクト: FranHurtado/traza
				FICHA DE ENTRADA DE MERCANCIAS
			</td>
		</tr>
		<tr>
			<td style="border: 1px solid #555;"><b>Fecha</b></td>
			<td style="border: 1px solid #555;"><b>Materia prima</b></td>
			<td style="border: 1px solid #555;"><b>Proveedor</b></td>
			<td style="border: 1px solid #555;"><b>Lote / Albaran</b></td>
			<td style="border: 1px solid #555;"><b>Estado</b></td>
			<td style="border: 1px solid #555;"><b>Temperatura</b></td>
			<td style="border: 1px solid #555;"><b>Caducidad</b></td>
			<td style="border: 1px solid #555;"><b>Observaciones</b></td>
		</tr>
		
		<?php 
$modelMerchandise = Merchandise::model()->findAllByAttributes(array("UserID" => Yii::app()->user->ID));
foreach ($modelMerchandise as $Merchandise) {
    ?>
				<tr>
					<td><?php 
    echo $Merchandise->Date;
    ?>
</td>
					<td><?php 
    echo $Merchandise->raw->Name;
    ?>
</td>
					<td><?php 
    echo $Merchandise->provider->Name;
    ?>
</td>
コード例 #6
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Merchandise::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }