public function testMorphManyWhereClausesCanBeRemoved()
 {
     $builder = new EloquentMorphResetBuilderStub();
     $parent = m::mock('Illuminate\\Database\\Eloquent\\Model');
     $parent->shouldReceive('getKey')->andReturn(1);
     $relation = new MorphMany($builder, $parent, 'morph');
     $relation->where('foo', '=', 'bar');
     list($wheres, $bindings) = $relation->getAndResetWheres();
     $this->assertEquals('bar', $bindings[0]);
     $this->assertEquals('Basic', $wheres[0]['type']);
     $this->assertEquals('foo', $wheres[0]['column']);
     $this->assertEquals('bar', $wheres[0]['value']);
 }
Esempio n. 2
0
 /**
  * Create a new has many relationship instance.
  * @return void
  */
 public function __construct(Builder $query, Model $parent, $type, $id, $isPublic, $localKey, $relationName = null)
 {
     $this->relationName = $relationName;
     $this->public = $isPublic;
     parent::__construct($query, $parent, $type, $id, $localKey);
     $this->addDefinedConstraints();
 }
Esempio n. 3
0
 /**
  * Create a new has many relationship instance.
  * @return void
  */
 public function __construct(Builder $query, Model $parent, $type, $id, $localKey, $relationName = null)
 {
     $this->relationName = $relationName;
     parent::__construct($query, $parent, $type, $id, $localKey);
 }