Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Kohana] 3 - zwracanie w metodach ORM, return nie dziala
lukaskolista
post
Post #1





Grupa: Zarejestrowani
Postów: 872
Pomógł: 94
Dołączył: 31.03.2010

Ostrzeżenie: (0%)
-----


Witam. Mam model ORM
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. class Model_File extends ORM {
  4.  
  5. protected
  6. $belongs_to = array('folders');
  7.  
  8. private
  9. $file_source = array();
  10.  
  11. public function __construct() {
  12. parent::__construct();
  13. }
  14.  
  15.  
  16. public function get_file_source($folder_id = null) {
  17. if ($folder_id === null) {
  18. $folder_id = $this->folder_id;
  19. }
  20.  
  21. $folder = ORM::factory('folder', $folder_id);
  22.  
  23. $this->file_source[] = $folder->name;
  24.  
  25. if ($folder->parent_id != 0) {
  26. $this->get_file_source($folder->parent_id);
  27. } else {
  28. $this->file_source = array_reverse($this->file_source);
  29. $file_source = '';
  30. foreach ($this->file_source as $folder_name) {
  31. $file_source .= $folder_name.'/';
  32. }
  33.  
  34. $file_source = substr($file_source, 0, -1);
  35. return $file_source;
  36. }
  37. }
  38. }
  39.  
  40. ?>


metoda get_file_source zwraca sciezke do pliku stworzona na podstawie bazy danych. Tworzy ja poprawnie, jednak nie zwraca jej do kontrolera. Domyslam sie, ze problem jest w return i w wykorzystaniu kohana 3 (w kohana 2) zwykle retur dzialalo. Wie ktos, co jest nie tak? Z gory dziekuje za pomoc
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 20:23