Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: atk4/dvdrental
base: day4
...
head fork: atk4/dvdrental
compare: day2
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 03, 2012
@romaninsh romaninsh fix for 4.2 a8b4f67
@romaninsh romaninsh 4.2 3b221f4
View
2  lib/Frontend.php
@@ -16,6 +16,6 @@ function init(){
$this->dbConnect();
$menu = $this->add('Menu',null,'Menu');
- $menu->addMenuItem('Manager','mgr');
+ $menu->addMenuItem('mgr','Manager');
}
}
View
2  lib/Model/Customer.php
@@ -1,6 +1,6 @@
<?php
class Model_Customer extends Model_Table {
- public $entity_code='customer';
+ public $table='customer';
function init(){
parent::init();
View
19 lib/Model/DVD.php
@@ -1,14 +1,21 @@
<?php
class Model_DVD extends Model_Table {
- public $entity_code='dvd';
+ public $table='dvd';
function init(){
parent::init();
- $this->addField('movie_id')->refModel('Model_Movie');
+ $this->hasOne('Movie');
$this->addField('code');
- }
- function toStringSQL($source_field, $dest_fieldname){
- return 'concat("DVD#",id,": ",(select name
- from movie m,dvd d where m.id=d.movie_id and d.id='.$source_field.')) as '.$dest_fieldname;
+
+ $self=$this;
+
+ $this->addExpression('name')->set(function($m,$q)use($self){
+ return $q->dsql()->fx('concat',array(
+ $self->getField('movie'),
+ ' (',
+ $self->getField('code'),
+ ')'
+ ));
+ });
}
}
View
2  lib/Model/Movie.php
@@ -1,6 +1,6 @@
<?php
class Model_Movie extends Model_Table {
- public $entity_code='movie';
+ public $table='movie';
function init(){
parent::init();
View
6 lib/Model/Rental.php
@@ -4,8 +4,8 @@ class Model_Rental extends Model_Table {
function init(){
parent::init();
- $this->addField('customer_id')->refModel('Model_Customer');
- $this->addField('dvd_id')->refModel('Model_DVD');
+ $this->hasOne('Customer');
+ $this->hasOne('DVD');
$this->addField('date_rented')->defaultValue(date('Y-m-d'))->type('date');
$this->addField('date_returned')->type('date');
@@ -15,6 +15,6 @@ function returnMovie(){
$this
->set('date_returned',date('Y-m-d'))
->set('is_returned',true)
- ->update();
+ ->save();
}
}

No commit comments for this range

Something went wrong with that request. Please try again.