1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Prevent crashes when more than one buildable for an object exists

Summary: This prevents a crash in applying build plans when more than one buildable exists for the same object.  It also adds a check into the "New Manual Build" page to ensure that users can't create a buildable for an object that already has one.

Test Plan: Tried to create a buildable for an object that already has one and a nice friendly error appeared.  Applied a build plan to a buildable whose object has two buildables and didn't get a crash any more.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7543
This commit is contained in:
James Rhodes 2013-11-09 07:03:07 -08:00 committed by epriestley
parent aca621e21f
commit 43847d6bd7

View file

@ -34,6 +34,7 @@ final class HarbormasterBuildable extends HarbormasterDAO
$buildable = id(new HarbormasterBuildableQuery()) $buildable = id(new HarbormasterBuildableQuery())
->setViewer($actor) ->setViewer($actor)
->withBuildablePHIDs(array($buildable_object_phid)) ->withBuildablePHIDs(array($buildable_object_phid))
->setLimit(1)
->executeOne(); ->executeOne();
if ($buildable) { if ($buildable) {
return $buildable; return $buildable;