private function fillEntity(Entity $entity) { foreach ($entity->getEntityFields() as $entityField) { if ($entityField->isEager()) { $this->fetchComposedEntity($entity, $entityField); } } return $entity; }
private function appendTableToEntityFields(Entity $entity) { $prefix = "moldp_" . $entity->getTableName(); $entityFields = " {$prefix}." . $entity->getTableId()->getFieldName() . " AS " . $prefix . "_" . $entity->getTableId()->getFieldName() . ","; foreach ($entity->getEntityFields() as $key => $entityField) { if (!$entityField->isMappedEntity()) { $entityFields .= " {$prefix}." . $entityField->getColumnName() . " AS " . $prefix . "_" . $entityField->getColumnName() . ","; } } return rtrim($entityFields, ","); }
/** * @param $entity Entity * @param $field String * @return String */ private static function getEntityFieldOrIdFieldFromEntityByParameter(Entity $entity, $field) { foreach ($entity->getEntityFields() as $key => $entityField) { if (strtoupper($entityField->getParameterName()) === strtoupper($field)) { return $entityField->getParameterName(); } } if (strtoupper($entity->getTableId()->getParameterName()) === strtoupper($field)) { return $entity->getTableId()->getParameterName(); } throw new InvalidArgumentException("Parameter '" . $field . "' not found in Entity " . get_class($entity)); }