Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1.   $all_clients = Doctrine::getTable('Client')->getClientsByAlphabet();
  2.         $this->alphabet_clients=array();
  3.         foreach ($all_clients as $client) {
  4.             $a = mb_substr($client['name'],0,1,'UTF-8');
  5.             $this->alphabet_clients[$a][]=$client;
  6.         }
  7.         print_r($this->alphabet_clients);
  8.  
  9. //model
  10.     public function getClientsByAlphabet(){
  11.         $q = $this->createQuery('c')
  12.                 ->from('Client c')
  13.                 ->leftJoin('c.Translation ct WITH ct.lang=?', sfDoctrineRecord::getDefaultCulture())
  14.                 ->select('c.slug,ct.name')
  15.                 ->orderBy('ct.name');
  16.         return $q->execute(array(), 'i18n_hydrator');
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement