๋๋ PartKeepr 1.3.0์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค
๋ถํ ์์ ๋ํ ์์๋ฅผ ์ด๊ธฐ ์ํด ๋ฐ์ฝ๋๋ฅผ ์ค์บํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ ๋์ฌ "PID-"+๋ถํ ๊ณ ์ ID๊ฐ ์๋ ๋ฐ์ฝ๋๋ฅผ ์์ฑํ์ต๋๋ค.
"Search Part"๋ฅผ Action์ผ๋ก ์ฌ์ฉํ์ฌ PartKeepr์ "PID-" ์ฝ๋๋ฅผ ์ค์ ํ ๋ค์ PartKeepr.PartBundle.Entity.Part๋ฅผ ์ ํํ์ต๋๋ค. @id ๋ฅผ ๊ฒ์ ํ๋๋ก ์ฌ์ฉํฉ๋๋ค.
์ ์ฅ ์์น์ ๋ํ ๋ค๋ฅธ ๋ฐ์ฝ๋๋ฅผ ์ค์บํ ์ ์์ผ๋ฉฐ ์์๋๋ก ํด๋น ์์น์ ๋ถํ์ ๋ํ ์ฟผ๋ฆฌ๋ฅผ ์ฝ๋๋ค. ์ด๊ฒ์ ๋ถํ ์กฐํ์๋ง ํด๋น๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
์๋ฅผ ๋ค์ด "PID-12"์ ๊ฐ์ ๋ฐ์ฝ๋๋ฅผ ์ค์บํ๋ฉด PartKeepr์ด ์ค์บ์ ์๋ตํ์ง๋ง ๋ค์ ์ค๋ฅ๋ฅผ ํ์ํฉ๋๋ค.
[๊ตฌ๋ฌธ ์ค๋ฅ] ํ 0, ์ด 83: ์ค๋ฅ: ์์ =, <, <=, <>, >, >=, !=, 'id'๋ฅผ ์ป์์ต๋๋ค.
GET http://192.168.0.196/parts/web/api/parts?_dc=1510689688405
500
{"@context":"\/parts\/web\/api\/contexts\/Error","@type":"์ค๋ฅ"," hydra:title ":"์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค"," hydra:description " :"[๊ตฌ๋ฌธ ์ค๋ฅ] ์ค 0, ์ด 83: ์ค๋ฅ: ์์ =, \u003C, \u003C=, \u003C\u003E, \u003E, \u003E=, !=, \u0027id\u0027์ ์ป์์ต๋๋ค."}
๊ต๋ฆฌ_orm_version: 2.5.4
๊ต๋ฆฌ_dbal_version: 2.5.2
๊ต๋ฆฌ_๊ณตํต_๋ฒ์ : 2.6.0-DEV
PHP_๋ฒ์ : 7.0.22-0ubuntu0.16.04.1
auto_start_session: ์ฐธ
์ต๋ ์
๋ก๋ ํฌ๊ธฐ: 2097152
isOctoPartAvailable: ๊ฑฐ์ง
์ฌ์ฉ ๊ฐ๋ฅํ ์ด๋ฏธ์ง ํ์: JPG, GIF, PNG
max_users: ๋ฌด์ ํ
authentication_provider: PartKeepr.Auth.HTTPBasicAuthenticationProvider
tip_of_the_day_uri: https://partkeepr.org/tips/%s
์ํธ ๋ณ๊ฒฝ: ์ฐธ
patreonStatus: [๊ฐ์ฒด ๊ฐ์ฒด]
๋๋ ์ฌ๊ธฐ์ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ์๊ณ ์๋ค๊ณ ์๊ฐํ์ง๋ง ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋ชจ๋ฆ ๋๋ค. GET ์์ฒญ์ id ๋ณ์ ์์ @๊ฐ ์ถ๊ฐ๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค.
์ค๋ฅ๊ฐ ๋ฐ์ํ์ ๋ get ์์ฒญ์ ์์ ํ๊ณ ํด๋น @ ๊ธฐํธ๋ฅผ ์ ๊ฑฐํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์๋ต์ด ํ์๋ฉ๋๋ค.
{"@context":"\/parts\/web\/api\/contexts\/Part","@id":"\/parts\/web\/api\/parts?_dc=1510773608949\u0026page=1\u0026start=0\u0026itemsPerPage=50\u0026group={"property":"categoryPath","direction":"ASC"}\u0026order=[{"property":"category.categoryPath","direction":"ASC"},{"property":"name","direction":"ASC"}]\u0026filter=[{"subfilters":[{"subfilters":[],"property":"id","operator":"LIKE","value":"43W"}],"type":"OR"}]","@type":"hydra:PagedCollection","hydra:totalItems":0,"hydra:itemsPerPage":50,"hydra:firstPage":"\/parts\/web\/api\/parts?_dc=1510773608949\u0026start=0\u0026itemsPerPage=50\u0026group={"property":"categoryPath","direction":"ASC"}\u0026order=[{"property":"category.categoryPath","direction":"ASC"},{"property":"name","direction":"ASC"}]\u0026filter=[{"subfilters":[{"subfilters":[],"property":"id","operator":"LIKE","value":"43W"}],"type":"OR"}]","hydra:lastPage":"\/parts\/web\/api\/parts?_dc=1510773608949\u0026start=0\u0026itemsPerPage=50\u0026group={"property":"categoryPath","direction":"ASC"}\u0026order=[{"property":"category.categoryPath","direction":"ASC"},{"property":"name","direction":"ASC"}]\u0026filter=[{"subfilters":[{"subfilters":[],"property":"id","operator":"LIKE","value":"43W"}],"type":"OR"}]","hydra:member":[],"hydra:search":{"@type":"hydra:IriTemplate","hydra:template":"\/parts\/web\/api\/parts{?}","hydra:variableRepresentation":"BasicRepresentation","hydra:mapping":[]}}
์กฐํ ์ฟผ๋ฆฌ๋ฅผ ํธ์ถํ๋๋ก UI์ ์๋ฆฌ๋ ์ฌ๋ฐ๋ฅธ ์๋ต์ ๋ฐํํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค...?
๋ฐ๋ผ์ ์ง๋ฌธ์ ์ด @๊ฐ ๋ฐ์ฝ๋ ์ค์บ์ GET ์ฟผ๋ฆฌ์ ํฌํจ๋๋ ๊ฒ์ ์ด๋ป๊ฒ ์ ํํ ์ ์์ต๋๊น?
์ข์, ์ด๊ฒ์ด ํด๊ฒฐ์ฑ ์ด ์๋ ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฐพ์์ต๋๋ค.
๋ค์ ํ์ผ์ ์์ ํด์ผ ํ๊ณ ์ด์ ๋ชจ๋ ๊ฒ์ด ์๋ํฉ๋๋ค. ํญ๋ชฉ ID๋ฅผ ์ค์บํ ์ ์๊ณ ์กฐํ๊ฐ ์์๋๋ก ์๋ํฉ๋๋ค.
/src/PartKeepr/DoctrineReflectionBundle/Filter/AdvancedSearchFilter.php
353ํ ์์ :
$filter->setProperty($data->property);
NS:
$filter->setProperty(str_replace("@","",$data->property));
๊ธฐ๋ณธ์ ์ผ๋ก ๋ฌธ์ ๋ฅผ ์ผ์ผํค๋ @ ๊ธฐํธ์ด๋ฉฐ GET Ajax ์์ฒญ์์ ์ ๊ฑฐํด์ผ ํฉ๋๋ค. ์ด๋์์ ๋ณ๊ฒฝํด์ผ ํ ์ง ์ ํํ ๋ชจ๋ฅด๊ฒ ์ง๋ง ์์ ์์ ์ ๋๊ตฐ๊ฐ๊ฐ ์ด๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ๋ฌ์ฑํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ฐจ์๋ฒจ์ ์ธ๋ฆด ๋๊น์ง ์์ ์์ ์ผ๋ก ์ ์๊ฒ ํจ๊ณผ์ ์ด์์ต๋๋ค...
๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. https://github.com/partkeepr/PartKeepr/issues/894 ์ ๋์ผํ ๊ฒ ๊ฐ์ต๋๋ค.
๋ ๋์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ src/PartKeepr/DoctrineReflectionBundle/Filter/AssociationPropertyTrait.php
์์ ์ง์ ์์ฑ ์ด๋ฆ์ ๋ฐ๊พธ๋ ๊ฒ์
๋๋ค.
public function setProperty($property)
{
$this->property = str_replace("@", "", $property);
}
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋ ๋์ ํด๊ฒฐ ๋ฐฉ๋ฒ์
src/PartKeepr/DoctrineReflectionBundle/Filter/AssociationPropertyTrait.php
์์ ์ง์ ์์ฑ ์ด๋ฆ์ ๋ฐ๊พธ๋ ๊ฒ์ ๋๋ค.