I’m looking for some help implementing [URL=”http://www.test-maths.me.uk/img/uml.svg”]this[/URL] in a PHP framework. Ive tried and [URL=”http://codeigniter.com/forums/viewthread/212714/”]failed[/URL] in CodeIgniter. Could someone offer a benchmark, could be CI, Cake or Kohana not fussy. I do like CI however. Files attached.
@1cookieauthorMar 30.2012 — #The class diagram you showed doesn't indicate any kind of web app. What are you expecting a framework to do for you?[/QUOTE]
hi
And thanks for the response. Indeed, as it stands it's not very useful in terms of a web application. I'm more interested in it from a OOP pattern perspective and in particular implementing this within one of the leading frameworks out there. For this example I'd be happy for the framework to output:
@Jeff_MottMar 30.2012 — #In the code your posted on the CI forum, you're var_dump-ing $lesson from outside the for loop, which means the variable $lesson probably won't have a value.
@Jeff_MottMar 30.2012 — #That's a very different set of errors than what was posted in the CI forum. You're going to have to show the code you're running.
@1cookieauthorMar 30.2012 — #That's a very different set of errors than what was posted in the CI forum. You're going to have to show the code you're running.[/QUOTE]
hi
OK. Give me one sec, I'll get my most current version from CI...
@1cookieauthorMar 30.2012 — #OK here's the main controller and the view:
[code=php] <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include ('/var/www/Composition/application/libraries/CostStrategy.php'); include ('/var/www/Composition/application/libraries/Lesson.php'); include ('/var/www/Composition/application/libraries/TimedCostStrategy.php'); include ('/var/www/Composition/application/libraries/FixedCostStrategy.php'); include ('/var/www/Composition/application/libraries/Lecture.php'); include ('/var/www/Composition/application/libraries/Seminar.php');
class Front extends CI_Controller {
public function __construct() { parent::__construct();
}
public function index() { $data['lessons'] = array(); $data['lessons'][] = new Seminar( 4, new TimedCostStrategy() ); $data['lessons'][] = new Lecture( 4, new FixedCostStrategy() );
Message: Missing argument 1 for Lesson::cost(), called in /var/www/Composition/application/views/index.php on line 11 and defined
Filename: libraries/Lesson.php
Line Number: 20 A PHP Error was encountered
Severity: 4096
Message: Argument 2 passed to Lesson::cost() must be an instance of CostStrategy, none given, called in /var/www/Composition/application/views/index.php on line 11 and defined
Filename: libraries/Lesson.php
Line Number: 20 lesson charge: 20. A PHP Error was encountered
Line Number: 30 Fatal error: Call to a member function chargeType() on a non-object in /var/www/Composition/application/libraries/Lesson.php on line 30