Example #1
0
 public function findOneById($id, $params = array())
 {
     $resource = $this->getEntityResource();
     $data = $this->access_service->findOneById($resource, $id, $params);
     if (!$data) {
         return null;
     }
     $object = $this->gamine_service->instantiateModel($this->entity_key);
     $object->fromDataArray($data);
     return $object;
 }
Example #2
0
 protected function _extractToDataArray($removeUnchanged = true)
 {
     $result = array();
     if ($this->_gamineservice) {
         $mapped_properties = $this->_gamineservice->getMappedProperties($this->entity_key);
     } else {
         $description = \RedpillLinpro\GamineBundle\Gamine::describeClass(get_called_class());
         $mapped_properties = $description['properties'];
     }
     foreach ($mapped_properties as $property => $mappings) {
         if (array_key_exists('relates', $mappings) && !array_key_exists('column', $mappings)) {
             continue;
         }
         $this->_extractDataArrayProperty($property, $mappings, $result, $removeUnchanged);
     }
     return $result;
 }