Jump to content
php.lv forumi

exceptioni


metal-0-1

Recommended Posts

  function get_articles()
  {
        $this->db->select('*'); // Nav obligāts
        $this->db->from('articles');
        $this->db->order_by('timestampp', 'desc');
        $query = $this->db->get();
        return $query->result();
  }

 

Kas par erroru, moš pārak veca php versija viņa neatbalsta public, static, private f-cijas <-- ir bijis pieredzē, bet rets gadijums

Link to comment
Share on other sites

Kā jāsaprot "Ar šo tiek atslēgta arī automātiska erroru rakstīšana log failā"? Tas tā nopietni CodeIgniter ir uztaisīts? Kas tas par debīlismu?

 

Anyway, try/catch ap "$articles = $this->articles_model->get_articles();", ja tev vajag konkrēti tajā situācijā, bet ja nē, tad normālam freimworkam vajadzētu būt globālam try/catch blokam tur, kur tiek izsaukts kontrolieris un action.

 

+ es kaut kā nesaprotu, nafig vajadzīgs tāds brīnums kā "$this->load->model('articles_model')"; var taču izmantot autoloading un vai nu statiskas metodes vai singleton.

Edited by jurchiks
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...