Permalink
Browse files

добавил возможность указания цены проектов

  • Loading branch information...
1 parent bf74f8a commit 62d03886de982bc03a38f437073ea4ed8d664a60 @FladeX committed Jan 3, 2012
@@ -142,7 +142,7 @@
<?php echo $projects->getText() ?>
</span>
</td>
- <td class="value">120</td>
+ <td class="value"><?php echo $projects->getPrice() ?></td>
<td class="value last">2</td>
</tr>
<?php endforeach; ?>
@@ -24,7 +24,7 @@
<tbody>
<tr>
<td>Цена:</td>
- <td class="value price">15 wmr</td>
+ <td class="value price"><?php echo $projects->getPrice() ?> wmr</td>
</tr>
<tr>
<td>Открыт до:</td>
@@ -74,6 +74,7 @@ projects:
author_id: { type: integer, notnull: true }
title: { type: string(255), notnull: true }
text: { type: string(4000), notnull: false }
+ price: { type: integer, notnull: false }
status: { type: integer, notnull: true, default: 0 }
relations:
users: { onDelete: CASCADE, local: author_id, foreign: id, foreignAlias: users }
@@ -3,6 +3,7 @@ projects:
author_id: 1
title: Автофорум
text: Posting for auto-forum. I need topics about sport-cars like Porshe, Ferrari, Lamborgini, etc.
+ price: 42
status: 1
second_project:
author_id: 1
View
@@ -2,7 +2,7 @@ CREATE TABLE badges (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, badges_i
CREATE TABLE bids (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, project_id BIGINT NOT NULL, text TEXT, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX project_id_idx (project_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE login_history (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, user_ip VARCHAR(255) NOT NULL, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE payments (id BIGINT AUTO_INCREMENT, sum FLOAT(18, 2) NOT NULL, user_id BIGINT NOT NULL, type VARCHAR(255) NOT NULL, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
-CREATE TABLE projects (id BIGINT AUTO_INCREMENT, author_id BIGINT NOT NULL, title VARCHAR(255) NOT NULL, text TEXT, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX author_id_idx (author_id), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE projects (id BIGINT AUTO_INCREMENT, author_id BIGINT NOT NULL, title VARCHAR(255) NOT NULL, text TEXT, price BIGINT, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX author_id_idx (author_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE reports (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, project_id BIGINT NOT NULL, posting_name VARCHAR(255) NOT NULL, posting_password VARCHAR(255) NOT NULL, posting_messages BIGINT NOT NULL, posting_date DATETIME NOT NULL, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX project_id_idx (project_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE reviews (id BIGINT AUTO_INCREMENT, author_id BIGINT NOT NULL, recepient_id BIGINT NOT NULL, text TEXT NOT NULL, type TINYINT(1) DEFAULT '1' NOT NULL, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX recepient_id_idx (recepient_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE search_history (id BIGINT AUTO_INCREMENT, query VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
@@ -16,6 +16,7 @@ public function setup()
'author_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('users'), 'add_empty' => true)),
'title' => new sfWidgetFormFilterInput(array('with_empty' => false)),
'text' => new sfWidgetFormFilterInput(),
+ 'price' => new sfWidgetFormFilterInput(),
'status' => new sfWidgetFormFilterInput(array('with_empty' => false)),
'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
@@ -25,6 +26,7 @@ public function setup()
'author_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('users'), 'column' => 'id')),
'title' => new sfValidatorPass(array('required' => false)),
'text' => new sfValidatorPass(array('required' => false)),
+ 'price' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
'status' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
@@ -51,6 +53,7 @@ public function getFields()
'author_id' => 'ForeignKey',
'title' => 'Text',
'text' => 'Text',
+ 'price' => 'Number',
'status' => 'Number',
'created_at' => 'Date',
'updated_at' => 'Date',
@@ -19,6 +19,7 @@ public function setup()
'author_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('users'), 'add_empty' => false)),
'title' => new sfWidgetFormInputText(),
'text' => new sfWidgetFormTextarea(),
+ 'price' => new sfWidgetFormInputText(),
'status' => new sfWidgetFormInputText(),
'created_at' => new sfWidgetFormDateTime(),
'updated_at' => new sfWidgetFormDateTime(),
@@ -29,6 +30,7 @@ public function setup()
'author_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('users'))),
'title' => new sfValidatorString(array('max_length' => 255)),
'text' => new sfValidatorString(array('max_length' => 4000, 'required' => false)),
+ 'price' => new sfValidatorInteger(array('required' => false)),
'status' => new sfValidatorInteger(array('required' => false)),
'created_at' => new sfValidatorDateTime(),
'updated_at' => new sfValidatorDateTime(),
@@ -8,19 +8,22 @@
* @property integer $author_id
* @property string $title
* @property string $text
+ * @property integer $price
* @property integer $status
* @property users $users
* @property Doctrine_Collection $projects
*
* @method integer getAuthorId() Returns the current record's "author_id" value
* @method string getTitle() Returns the current record's "title" value
* @method string getText() Returns the current record's "text" value
+ * @method integer getPrice() Returns the current record's "price" value
* @method integer getStatus() Returns the current record's "status" value
* @method users getUsers() Returns the current record's "users" value
* @method Doctrine_Collection getProjects() Returns the current record's "projects" collection
* @method projects setAuthorId() Sets the current record's "author_id" value
* @method projects setTitle() Sets the current record's "title" value
* @method projects setText() Sets the current record's "text" value
+ * @method projects setPrice() Sets the current record's "price" value
* @method projects setStatus() Sets the current record's "status" value
* @method projects setUsers() Sets the current record's "users" value
* @method projects setProjects() Sets the current record's "projects" collection
@@ -49,6 +52,10 @@ public function setTableDefinition()
'notnull' => false,
'length' => 4000,
));
+ $this->hasColumn('price', 'integer', null, array(
+ 'type' => 'integer',
+ 'notnull' => false,
+ ));
$this->hasColumn('status', 'integer', null, array(
'type' => 'integer',
'notnull' => true,
Oops, something went wrong.

0 comments on commit 62d0388

Please sign in to comment.