Esempio n. 1
0
 /**
  * Convert the dql sections from the entity managers in a configuration from foxxmd/laravel-doctrine into a string representation of a php array configuration for custom string/numeric/datetime functions
  *
  * Returns null if no dql sections were found.
  *
  * @param $sourceManagers
  * @return null|string
  */
 public function convertDQL($sourceManagers)
 {
     $dqls = [];
     foreach ($sourceManagers as $manager) {
         if (($dql = ArrayUtil::get($manager['dql'])) !== null) {
             if (($dt = ArrayUtil::get($manager['dql']['datetime_functions'])) !== null) {
                 array_push($dqls['custom_datetime_functions'], $dt);
             }
             if (($num = ArrayUtil::get($manager['dql']['numeric_functions'])) !== null) {
                 array_push($dqls['custom_numeric_functions'], $num);
             }
             if (($string = ArrayUtil::get($manager['dql']['string_functions'])) !== null) {
                 array_push($dqls['custom_string_functions'], $string);
             }
         }
     }
     if (!empty($dqls)) {
         $results = $this->viewFactory->make('mitchel.dql', ['dql' => $dqls])->render();
         $unescaped = html_entity_decode($results, ENT_QUOTES);
         return $unescaped;
     } else {
         return null;
     }
 }
Esempio n. 2
0
 /**
  * Determine if configuration is from FoxxMD fork or original Mitchell repo
  *
  * @param $sourceArray
  *
  * @return bool
  */
 protected function isFork($sourceArray)
 {
     return ArrayUtil::get($sourceArray['entity_managers']) !== null;
 }
Esempio n. 3
0
 public function test_can_pass_custom_default_value()
 {
     $values = ['key' => 'value'];
     $this->assertEquals('default', ArrayUtil::get($values['key2'], 'default'));
 }
Esempio n. 4
0
 /**
  * Convert a cache section from mitchellvanw/laravel-doctrine to a string representation of a php array configuration for a cache section for this project
  *
  * @param array $sourceArray
  *
  * @return string
  */
 public function convertCache($sourceArray)
 {
     if (isset($sourceArray['cache']['provider'])) {
         $cacheProvider = ArrayUtil::get($sourceArray['cache']['provider']);
         $results = $this->viewFactory->make('atrauzzi.cache', ['cacheProvider' => $cacheProvider, 'extras' => count($sourceArray['cache']) > 1])->render();
         return $this->unescape($results);
     }
     return null;
 }