/** * Declares an association between this object and a User object. * * @param User $v * @return Comment The current object (for fluent API support) * @throws PropelException */ public function setUser(User $v = null) { if ($v === null) { $this->setUserId(NULL); } else { $this->setUserId($v->getId()); } $this->aUser = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the User object, it will not be re-added. if ($v !== null) { $v->addComment($this); } return $this; }
$str = $user->toString(); echo $str . PHP_EOL; echo "Problem 3:</br>"; $workman = new Workman("Pencho", "Kubadinski", "15", "picture", "male", "terorero", "who am i?", "batman", "*****@*****.**", $cars = array(new Car("Kia", "Carens", "1.6", "2004"), new Car("VW", "Golf", "1.8", "1997")), "Plumber", "15"); $str = $workman->toString(); echo $str . PHP_EOL; echo "Problem 4:</br>"; $user->setUserData("I am a man !!!<br/>"); $user->getUserData(); echo "<br/>"; echo "Problem 5:</br>"; $workman1 = new Workman("Gancho", "Kubadinski", "35", "picture", "male", "terorero", "who am i?", "batman", "*****@*****.**", $cars = array(new Car("Kia", "Carens", "1.6", "2004"), new Car("VW", "Golf", "1.8", "1997")), "Plumber", "15"); $workman2 = new Workman("Pyrvolet", "Kubadinski", "25", "picture", "male", "terorero", "who am i?", "batman", "*****@*****.**", $cars = array(new Car("Kia", "Carens", "1.6", "2004"), new Car("VW", "Golf", "1.8", "1997")), "IT", "25"); $workman3 = new Workman("Mihail", "Asenov", "17", "picture", "male", "terorero", "who am i?", "batman", "*****@*****.**", $cars = array(new Car("Kia", "Carens", "1.6", "2004"), new Car("VW", "Golf", "1.8", "1997")), "Football", "170"); $workers = array($workman, $workman1, $workman2, $workman3); $isExistWorkman = Workman::search($workers, "25", "IT"); if ($isExistWorkman) { echo "User found"; echo $isExistWorkman->toString(); } echo "<br/>"; echo "Problem 6 test" . "<br/>"; $user = new User("Petyr", "Petrov", "38", "picture", "male", "terorero", "who am i?", "batman", "*****@*****.**", $cars = array(new Car("Kia", "Carens", "1.6", "2004"), new Car("VW", "Golf", "1.8", "1997"))); $user->addComment(new Comment("this is my first comment", $user)); $comments = User::showCommentsByUser($user); var_dump($comments); die; ?> </body> </html>