コード例 #1
2
 /**
  * Create a new has many relationship instance.
  *
  * @param  \Sgpatil\Orientdb\Eloquent\Builder  $query
  * @param  \Sgpatil\Orientdb\Eloquent\Model  $parent
  * @param  string  $type
  * @return void
  */
 public function __construct(Builder $query, Model $parent, $foreignKey, $localKey)
 {
     $this->localKey = $localKey;
     $this->foreignKey = $foreignKey;
     $this->query = $query;
     $this->parent = $parent;
     $this->related = $query->getModel();
     parent::__construct($query, $parent, $foreignKey->getTable(), $localKey);
 }
コード例 #2
0
 /**
  * Remove the original where clause set by the relationship.
  *
  * The remaining constraints on the query will be reset and returned.
  *
  * @return array
  */
 public function getAndResetWheres()
 {
     // We actually need to remove two where clauses from polymorphic queries so we
     // will make an extra call to remove the first where clause here so that we
     // remove two total where clause from the query leaving only custom ones.
     $this->removeFirstWhereClause();
     return parent::getAndResetWheres();
 }
コード例 #3
0
 /**
  * Create a new has many relationship instance.
  *
  * @param  \Vinelab\NeoEloquent\Eloquent\Builder  $query
  * @param  \Vinelab\NeoEloquent\Eloquent\Model  $parent
  * @param  string  $type
  * @return void
  */
 public function __construct(Builder $query, Model $parent, $type, $key, $relation)
 {
     $this->localKey = $key;
     $this->relation = $relation;
     $this->type = $this->foreignKey = $type;
     parent::__construct($query, $parent, $type, $key);
     $this->finder = $this->newFinder();
 }
コード例 #4
0
ファイル: HasOneOrMany.php プロジェクト: sgpatil/neoeloquent
 /**
  * Create a new has many relationship instance.
  *
  * @param  \Vinelab\NeoEloquent\Eloquent\Builder  $query
  * @param  \Vinelab\NeoEloquent\Eloquent\Model  $parent
  * @param  string  $type
  * @return void
  */
 public function __construct(Builder $query, Model $parent, $type, $key, $relation)
 {
     $this->localKey = $key;
     // mb_strtolower added to make relation ship label in small case
     $this->relation = mb_strtolower($relation);
     $this->type = $this->foreignKey = $type;
     parent::__construct($query, $parent, $type, $key);
     $this->finder = $this->newFinder();
 }
コード例 #5
0
ファイル: MorphOneOrMany.php プロジェクト: scrobot/Lumen
 /**
  * Attach a model instance to the parent model.
  *
  * @param  \Illuminate\Database\Eloquent\Model $model
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function save(Model $model)
 {
     $model->setAttribute($this->getPlainMorphType(), $this->morphClass);
     return parent::save($model);
 }
コード例 #6
0
 protected function joinHasRelation(Relations\HasOneOrMany $relation, $type)
 {
     $table = $relation->getRelated()->getTable();
     $foreignKey = $relation->getForeignKey();
     $localKey = $relation->getQualifiedParentKeyName();
     $this->query->join($table, $foreignKey, '=', $localKey, $type);
 }
コード例 #7
0
 private function generateNullConditionFromHasOneOrMany(HasOneOrMany $relation)
 {
     $this->query = $this->query->whereNull($relation->getForeignKey());
 }
コード例 #8
0
ファイル: Values.php プロジェクト: dkulyk/eloquent-extra
 /**
  * Values constructor.
  *
  * @param Builder        $query
  * @param Eloquent       $parent
  * @param string         $foreignKey
  * @param string         $localKey
  * @param BaseCollection $properties
  */
 public function __construct(Builder $query, Eloquent $parent, $foreignKey, $localKey, BaseCollection $properties = null)
 {
     $this->setProperties($properties);
     parent::__construct($query, $parent, $foreignKey, $localKey);
 }