コード例 #1
0
ファイル: Member.php プロジェクト: khaliqgant/Deep
 /**
  * {@inheritdoc}
  */
 public function attributesToArray()
 {
     $array = parent::attributesToArray();
     foreach ($array as $key => $value) {
         if (strncmp($key, 'm_field_id_', 11) === 0) {
             $id = substr($key, 11);
             if (self::$memberFieldRepository->hasFieldId($id)) {
                 $array[self::$memberFieldRepository->getFieldName($id)] = $value;
             }
             unset($array[$key]);
         }
     }
     return $array;
 }
コード例 #2
0
ファイル: TitleModelTest.php プロジェクト: khaliqgant/Deep
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $fieldRepository = new FieldRepository(new Field());
     $categoryFieldRepository = new CategoryFieldRepository(new CategoryField());
     $memberFieldRepository = new MemberFieldRepository(new MemberField());
     $channelRepository = new ChannelRepository(new Channel(), $fieldRepository);
     $siteRepository = new SiteRepository(new Site());
     $uploadPrefRepository = new UploadPrefRepository(new UploadPref());
     $hydratorFactory = new HydratorFactory(Model::resolveConnection(Model::getGlobalConnection()), $siteRepository, $uploadPrefRepository, new Asset(), new File(), new GridCol(), new GridRow(), new MatrixCol(), new MatrixRow(), new PlayaEntry(), new RelationshipEntry());
     Category::setCategoryFieldRepository($categoryFieldRepository);
     Category::setChannelRepository($channelRepository);
     Member::setMemberFieldRepository($memberFieldRepository);
     Title::setChannelRepository($channelRepository);
     Title::setSiteRepository($siteRepository);
     Title::setHydratorFactory($hydratorFactory);
 }
コード例 #3
0
ファイル: ServiceProvider.php プロジェクト: khaliqgant/Deep
 /**
  * {@inheritdoc}
  */
 public function register()
 {
     if ($connection = $this->app['config']->get('database.deep.connection')) {
         Model::setGlobalConnection($connection);
     }
     $this->app->singleton('deep', function () {
         return new Deep();
     });
     $this->app->singleton('deep.entry', function ($app) {
         return $app->make('deep')->make('Entry');
     });
     $this->app->singleton('deep.title', function ($app) {
         return $app->make('deep')->make('Title');
     });
     $this->app->singleton('deep.category', function ($app) {
         return $app->make('deep')->make('Category');
     });
 }
コード例 #4
0
ファイル: Deep.php プロジェクト: khaliqgant/Deep
 /**
  * Set Eloquent to use CodeIgniter's DB connection
  *
  * Set Deep to use upload prefs from config.php,
  * rather than from DB, if applicable.
  *
  * @return void
  */
 public static function bootEE(CI_Controller $ee)
 {
     static $booted = false;
     if ($booted) {
         return;
     }
     if (!Model::getConnectionResolver() instanceof CodeIgniterConnectionResolver) {
         Model::setConnectionResolver(new CodeIgniterConnectionResolver($ee));
     }
     self::extendInstance('config', function ($app) use($ee) {
         return $ee->config->config;
     });
     $uploadPrefs = $ee->config->item('upload_preferences');
     if ($uploadPrefs) {
         self::extendInstance('UploadPrefRepository', function ($app) use($uploadPrefs) {
             return new ConfigUploadPrefRepository($uploadPrefs);
         });
     }
     $booted = true;
 }
コード例 #5
0
ファイル: File.php プロジェクト: khaliqgant/Deep
 /**
  * {@inheritdoc}
  */
 public function attributesToArray()
 {
     $attributes = parent::attributesToArray();
     foreach (array('upload_date', 'modified_date') as $key) {
         if (isset($attributes[$key]) && $attributes[$key] instanceof Carbon) {
             $attributes[$key] = (string) $attributes[$key];
         }
     }
     return $attributes;
 }