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