Exemplo n.º 1
0
 public function test_where()
 {
     $select = new Jam_Query_Builder_Select('test_post');
     $select->where('test_post.test_author_id', '=', 10);
     $this->assertEquals('SELECT `test_posts`.* FROM `test_posts` WHERE `test_posts`.`test_author_id` = 10', (string) $select);
 }
Exemplo n.º 2
0
 /**
  * Generated a find_by_slug method for Jam_Builder
  * @param  Jam_Builder    $builder the builder object
  * @param  string           $slug    the slug to search for
  * @param  Jam_Event_Data $data
  * @return void
  */
 public function builder_call_where_slug(Jam_Query_Builder_Select $builder, Jam_Event_Data $data, $slug)
 {
     if (preg_match($this->_pattern, $slug, $matches)) {
         $builder->where($this->_uses_primary_key ? ':primary_key' : 'slug', '=', $matches[$this->_uses_primary_key ? 2 : 0]);
     } else {
         throw new Kohana_Exception("Invalid Slug :slug for :model", array(':slug' => $slug, ':model' => $builder->meta()->model()));
     }
 }
Exemplo n.º 3
0
 /**
  * Generate a where_token method for Jam_Query_Builder_Select
  * @param  Jam_Query_Builder_Select $builder the builder object
  * @param  Jam_Event_Data $data
  * @param  string $token the token to search for
  * @return void
  */
 public function builder_call_where_token(Jam_Query_Builder_Select $builder, Jam_Event_Data $data, $token)
 {
     $builder->where($this->_model . '.' . $this->_field, '=', $token);
 }