Esempio n. 1
0
 /**
  * Constructor
  *
  * @param \rsanchez\Deep\Model\Channel $model
  */
 public function __construct(Channel $model)
 {
     $this->model = $model;
     $this->collection = $this->model->all();
     foreach ($this->collection as $channel) {
         $this->channelsById[$channel->channel_id] = $channel;
         $this->channelsByName[$channel->channel_name] = $channel;
     }
 }
Esempio n. 2
0
 public function testGetFieldsByChannelCollection()
 {
     $channels = Channel::where('channel_id', 1)->get();
     $fields = $this->repository->getFieldsByChannelCollection($channels);
     $ids = [];
     foreach ($fields as $field) {
         $ids[] = $field->field_id;
     }
     $this->assertThat($ids, new ArrayHasOnlyValuesConstraint([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]));
 }
Esempio n. 3
0
 public function setUp()
 {
     $this->all = Channel::all();
     $this->channel = Channel::find(1);
 }
Esempio n. 4
0
 /**
  * Constructor
  *
  * Build all the dependencies
  *
  * @var array $config  an EE config array
  */
 public function __construct($config = array())
 {
     Carbon::setToStringFormat(Carbon::ISO8601);
     $this->singleton('config', function ($app) use($config) {
         return $config;
     });
     $this->bind('db', function ($app) {
         return Model::resolveConnection(Model::getGlobalConnection());
     });
     $this->singleton('Field', function ($app) {
         return new Field();
     });
     $this->singleton('FieldRepository', function ($app) {
         return new FieldRepository($app->make('Field'));
     });
     $this->singleton('Channel', function ($app) {
         $channel = new Channel();
         $channel->setFieldRepository($app->make('FieldRepository'));
         return $channel;
     });
     $this->singleton('Site', function ($app) {
         return new Site();
     });
     $this->singleton('UploadPref', function ($app) {
         return new UploadPref();
     });
     $this->singleton('CategoryField', function ($app) {
         return new CategoryField();
     });
     $this->singleton('MemberField', function ($app) {
         return new MemberField();
     });
     $this->singleton('CategoryFieldRepository', function ($app) {
         return new CategoryFieldRepository($app->make('CategoryField'));
     });
     $this->singleton('MemberFieldRepository', function ($app) {
         return new MemberFieldRepository($app->make('MemberField'));
     });
     $this->singleton('ChannelRepository', function ($app) {
         return new ChannelRepository($app->make('Channel'));
     });
     $this->singleton('SiteRepository', function ($app) {
         return new SiteRepository($app->make('Site'));
     });
     $this->singleton('UploadPrefRepository', function ($app) {
         if (isset($app['config']['upload_prefs'])) {
             return new ConfigUploadPrefRepository($app['config']['upload_prefs']);
         }
         return new UploadPrefRepository($app->make('UploadPref'));
     });
     $this->singleton('Asset', function ($app) {
         return new Asset();
     });
     $this->singleton('File', function ($app) {
         return new File();
     });
     $this->singleton('GridCol', function ($app) {
         return new GridCol();
     });
     $this->singleton('GridRow', function ($app) {
         return new GridRow();
     });
     $this->singleton('MatrixCol', function ($app) {
         return new MatrixCol();
     });
     $this->singleton('MatrixRow', function ($app) {
         return new MatrixRow();
     });
     $this->singleton('PlayaEntry', function ($app) {
         return new PlayaEntry();
     });
     $this->singleton('RelationshipEntry', function ($app) {
         return new RelationshipEntry();
     });
     $this->singleton('HydratorFactory', function ($app) {
         return new HydratorFactory($app->make('db'), $app->make('SiteRepository'), $app->make('UploadPrefRepository'), $app->make('Asset'), $app->make('File'), $app->make('GridCol'), $app->make('GridRow'), $app->make('MatrixCol'), $app->make('MatrixRow'), $app->make('PlayaEntry'), $app->make('RelationshipEntry'));
     });
     $this->singleton('Category', function ($app) {
         $category = new Category();
         $category->setCategoryFieldRepository($app->make('CategoryFieldRepository'));
         $category->setChannelRepository($app->make('ChannelRepository'));
         return $category;
     });
     $this->singleton('Member', function ($app) {
         $member = new Member();
         $member->setMemberFieldRepository($app->make('MemberFieldRepository'));
         return $member;
     });
     $this->singleton('Title', function ($app) {
         $app->make('Category');
         $app->make('Member');
         $title = new Title();
         $title->setChannelRepository($app->make('ChannelRepository'));
         $title->setSiteRepository($app->make('SiteRepository'));
         $title->setHydratorFactory($app->make('HydratorFactory'));
         return $title;
     });
     $this->singleton('Entry', function ($app) {
         $app->make('Title');
         $entry = new Entry();
         $entry->setFieldRepository($app->make('FieldRepository'));
         return $entry;
     });
 }