/** * @param string $fnName */ private function handleDebug($fnName) { if ($fnName === $this->debugFunction) { Enjoin::debug(true); } }
public function getRelations() { return [Enjoin::hasMany(Enjoin::get('Books'), ['foreignKey' => 'languages_id'])]; }
public function getRelations() { return [Enjoin::belongsTo(Enjoin::get('Books'), ['foreignKey' => 'books_id']), Enjoin::belongsTo(Enjoin::get('Publishers'), ['foreignKey' => 'publishers_id']), Enjoin::hasMany(Enjoin::get('Shipped'), ['foreignKey' => 'publishers_books_id']), Enjoin::hasMany(Enjoin::get('Preorders'), ['foreignKey' => 'publishers_books_id'])]; }
public function getRelations() { return [Enjoin::belongsTo(Enjoin::get('Books'), ['foreignKey' => 'books_id'])]; }
public function getAttributes() { return ['id' => ['type' => Enjoin::Integer()], 'date_till' => ['type' => Enjoin::Date()]]; }
public function getRelations() { return [Enjoin::belongsTo(Enjoin::get('Authors'), ['foreignKey' => 'authors_id']), Enjoin::belongsTo(Enjoin::get('Languages'), ['foreignKey' => 'languages_id']), Enjoin::hasMany(Enjoin::get('Reviews'), ['foreignKey' => 'books_id']), Enjoin::hasMany(Enjoin::get('PublishersBooks'), ['foreignKey' => 'books_id'])]; }
/** * @param \Enjoin\Record\Record $Record * @param array $volume * @return mixed */ private static function savePersistent(Record $Record, array $volume) { $scope = $Record->scope(); $Model = Enjoin::get($scope->modelName); $DB = $Model->connection(); return $DB->transaction(function () use($volume, $scope, $Model) { if (isset($volume['id']) && $volume['id'] === $scope->id) { unset($volume['id']); } $Model->queryBuilder()->where('id', $scope->id)->take(1)->update($volume); // id can be changed $Model->cache()->flush(); return isset($volume['id']) ? $volume['id'] : $scope->id; }); }
public function getRelations() { return [Enjoin::belongsTo(Enjoin::get('Authors'), ['foreignKey' => 'authors_id'])]; }
public function getRelations() { return [Enjoin::hasMany(Enjoin::get('PublishersBooks'), ['foreignKey' => 'publishers_id']), Enjoin::belongsTo(Enjoin::get('Publishers'), ['foreignKey' => 'pid', 'as' => 'parent']), Enjoin::hasMany(Enjoin::get('Publishers'), ['foreignKey' => 'pid', 'as' => 'child'])]; }
public function getRelations() { return [Enjoin::hasMany(Enjoin::get('Articles'), ['foreignKey' => 'authors_id']), Enjoin::hasMany(Enjoin::get('Books'), ['foreignKey' => 'authors_id'])]; }