Example #1
0
 /**
  * Get meta data, key support dot notation levels
  * @param  string $key
  * @return mixed
  */
 public function getMeta($key = null)
 {
     if (!is_array($this->meta)) {
         return $this->meta;
     } else {
         return H::arrayGet($this->meta, $key);
     }
 }
Example #2
0
 /**
  * Get registered class name
  * @param  string $type
  * @return void
  */
 public function getRegisteredClass($type)
 {
     return H::arrayGet($this->classes, $type, false);
 }
Example #3
0
 public function testArrayIsMulti()
 {
     $this->assertTrue(H::arrayIsMulti(array('foo' => 'bar', 'bar' => array('foo' => 'bar'))));
     $this->assertFalse(H::arrayIsMulti(array('foo' => 'bar', 'bar' => 'foo')));
 }
Example #4
0
 protected function getKey($type)
 {
     return H::arrayGet($this->keys, $type);
 }
Example #5
0
 /**
  * Get value of PK
  * @return mixed
  */
 public function getKey()
 {
     return H::arrayGet($this->attributes, static::$key);
 }
Example #6
0
 /**
  * Build relationship models using in model data
  * @param  string $key attribute name
  * @return array
  */
 protected function getInModelData($key)
 {
     $model = $this->getCallingModel();
     if ($model->attributeExists($key)) {
         $data = $model->getRawAttribute($key);
         if (H::arrayIsAssoc($data)) {
             $data = array($data);
         }
         return $this->query->buildModels($data);
     }
     return false;
 }