Пример #1
0
 /**
  * @param string $fnName
  */
 private function handleDebug($fnName)
 {
     if ($fnName === $this->debugFunction) {
         Enjoin::debug(true);
     }
 }
Пример #2
0
 public function getRelations()
 {
     return [Enjoin::hasMany(Enjoin::get('Books'), ['foreignKey' => 'languages_id'])];
 }
Пример #3
0
 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'])];
 }
Пример #4
0
 public function getRelations()
 {
     return [Enjoin::belongsTo(Enjoin::get('Books'), ['foreignKey' => 'books_id'])];
 }
Пример #5
0
 public function getAttributes()
 {
     return ['id' => ['type' => Enjoin::Integer()], 'date_till' => ['type' => Enjoin::Date()]];
 }
Пример #6
0
 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'])];
 }
Пример #7
0
 /**
  * @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;
     });
 }
Пример #8
0
 public function getRelations()
 {
     return [Enjoin::belongsTo(Enjoin::get('Authors'), ['foreignKey' => 'authors_id'])];
 }
Пример #9
0
 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'])];
 }
Пример #10
0
 public function getRelations()
 {
     return [Enjoin::hasMany(Enjoin::get('Articles'), ['foreignKey' => 'authors_id']), Enjoin::hasMany(Enjoin::get('Books'), ['foreignKey' => 'authors_id'])];
 }