Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_learningpath web service - refs BT#17453 #3367

Open
wants to merge 16 commits into
base: 1.11.x
Choose a base branch
from

Conversation

sebastiendu
Copy link

Moved most learning path creation code from main/lp/learnpath.class.php to CourseBundle/Entity/CLp.php and CLpItem.php.

@FlintCIBot
Copy link

Lint errors were found. A patch is also available.

Please see the report: https://flintci.io/repositories/1013/analyses/37551

This comment was posted by FlintCI. It can be disabled in the repository settings.

@FlintCIBot
Copy link

Lint errors were found. A patch is also available.

Please see the report: https://flintci.io/repositories/1013/analyses/37554

This comment was posted by FlintCI. It can be disabled in the repository settings.

@@ -96,6 +109,14 @@ public function __toString()
return (string) $this->getUrl();
}

/**
* @return Repository\AccessUrlRepository|EntityRepository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try not to mix legacy code (Database class) with new code (Entities), better to just use in the code

$repo = Database::getManager()->getRepository('ChamiloCoreBundle:AccessUrl');

}

$file_path = handle_uploaded_document(
$course = \Chamilo\CoreBundle\Entity\Course::getRepository()->find($course_id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use api_get_course_entity($course_id); so you won't need the Course::getRepository() function


$file_path = handle_uploaded_document(
$course = \Chamilo\CoreBundle\Entity\Course::getRepository()->find($course_id);
$learningPath = CLp::getRepository()->find($this->get_id());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can create a new function api_get_lp_entity($lpId); so you won't need to call the CLp::getRepository()

*/
public static function getCurrentCourse()
{
return self::getRepository()->find(api_get_course_int_id());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not to mix legacy code (from api.lib.php), to this new entity classes...

Sébastien Ducoulombier added 2 commits July 13, 2020 14:34
Partialy simplified and already improved performance of these API functions:
 api_item_property_update
 api_max_sort_value
 CourseManager::create_course
 AddCourse::register_course
 CourseManager::fillCourse
 AddCourse::fill_db_course
 learnpath::add_lp
@FlintCIBot
Copy link

Lint errors were found. A patch is also available.

Please see the report: https://flintci.io/repositories/1013/analyses/37637

This comment was posted by FlintCI. It can be disabled in the repository settings.

Sébastien Ducoulombier added 4 commits July 13, 2020 15:07
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'c_id' cannot be null
Course::prePersist calls Course::createSettings
@NicoDucou
Copy link
Member

Ce PR est inclus dans le PR #3372 donc il sera revu directement dans cet autre PR qui contient d'autres Web Services en même temps.

@jmontoyaa
Copy link
Member

This PR has code already sent in #3372 and it has the same issues (database changes, core chamilo refactoring)

@FlintCIBot
Copy link

Lint errors were found. A patch is also available.

Please see the report: https://flintci.io/repositories/1013/analyses/37789

This comment was posted by FlintCI. It can be disabled in the repository settings.

* )
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/
protected $course;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmontoyaa Can this association mapping for entities generate a change in the DB structure?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, It will create FKs in the database.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which should not create any problem, since only new Chamilo installations will get this new foreign key constraint (which is a security). Existing database will not be altered.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...which leaves us with only the large changes to the core processes of Chamilo (even if only a change in form), which is a bit too risky to include in the code a few days before the release (we have to live with that with users support for months if there is something wrong).
The inclusion of this PR is thus postponed to after the 1.11.12 release.
I want to stress that this is not about bad code or anything (to the countrary). It is about the size of the changes and the corresponding risk.

Sébastien Ducoulombier added 3 commits July 30, 2020 09:27
learning path item removal does not cascade-remove its learning path
AccessUrlRelCourse removal does not cascade-remove its course and url
CItemProperty removal does not cascade-remove its session
@FlintCIBot
Copy link

Lint errors were found. A patch is also available.

Please see the report: https://flintci.io/repositories/1013/analyses/39767

This comment was posted by FlintCI. It can be disabled in the repository settings.

@ywarnier ywarnier added this to the 2.0 milestone Aug 9, 2021
@ywarnier ywarnier removed this from the 2.0 milestone Jan 13, 2024
@ywarnier ywarnier added this to the 2.1 milestone Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants