![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 168 Pomógł: 126 Dołączył: 5.02.2010 Skąd: Świdnica Ostrzeżenie: (0%) ![]() ![]() |
Witam,
chciałem zobaczyć jak Symfony2 poradzi sobie jako API i w tym celu chciałem wykorzystać ActionScript3.0 + Symfony2 (PHP) więc mam sobie jakąś aplikację, która wysyła z flasha json ( { id:1 } ) więc flash oczekuje wszystkich kolumn, które należą do ID = 1. Jako z tym nie mam problemu, bo normalnie mogę zrobić to tak:
ale jak to samo zrobić w Symfony2 ?
var_dump zwraca
Ale nijak nie potrafię się po tym ruszyć... EDIT:: Doszedłem do tego, że po zmianie w klasie Userzy.php (entity) z private na public mam dostęp do np print $entities[0]->name; w przeciwnym razie otrzymuję error Cannot access private property SimonMedia\ApiBundle\Entity\Userzy::$name in F:\WORK\labs\Symfony\ApiID\src\SimonMedia\ApiBundle\Controller\DefaultController.php on line 28 Ale chyba taka zmiana nie jest dobra i nie na tym to ma polegać ? Ten post edytował Szymciosek 16.09.2012, 11:06:44 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 1 168 Pomógł: 126 Dołączył: 5.02.2010 Skąd: Świdnica Ostrzeżenie: (0%) ![]() ![]() |
Witam ponownie, nie chciałem zakładać nowego tematu tylko zapytam tutaj.
Jak sprawdzić czy dana kolumna istnieje nie pobierając z entity wszystkich danych ? Tzn. mam takiego coś:
i teraz jeśli zrobię otrzymuję: Kod object(Doctrine\ORM\EntityRepository)[364] ... public 'fieldNames' => array (size=13) 'id' => string 'id' (length=2) 'username' => string 'username' (length=8) 'first_name' => string 'first_name' (length=10) 'last_name' => string 'last_name' (length=9) 'email_address' => string 'email_address' (length=13) 'locale' => string 'locale' (length=6) 'password' => string 'password' (length=8) 'created' => string 'created' (length=7) 'last_login' => string 'last_login' (length=10) 'user_rank' => string 'user_rank' (length=9) 'active' => string 'active' (length=6) 'user_token' => string 'user_token' (length=10) 'ip_address' => string 'ip_address' (length=10) public 'columnNames' => array (size=13) 'id' => string 'id' (length=2) 'username' => string 'username' (length=8) 'first_name' => string 'first_name' (length=10) 'last_name' => string 'last_name' (length=9) 'email_address' => string 'email_address' (length=13) 'locale' => string 'locale' (length=6) 'password' => string 'password' (length=8) 'created' => string 'created' (length=7) 'last_login' => string 'last_login' (length=10) 'user_rank' => string 'user_rank' (length=9) 'active' => string 'active' (length=6) 'user_token' => string 'user_token' (length=10) 'ip_address' => string 'ip_address' (length=10) ... I oczywiście chce się dostać do fieldNames lub columnNames, bo widzę, że to, to samo więc nie powinno robić różnicy, które wybiorę. Podczas pobrania wszystkich danych za pomocą findAll() zadanie byłoby ułatwione, bo dostanę wtedy wszystkie kolumny i ich wartości, lecz nie o to mi chodzi, bo przyjdzie sytuacja, w której będę musiał pobrać tylko username i first_name i co wtedy ? Za pomocą createQuery("SHOW COLUMNS... nie jestem w stanie tego zrobić, bo wywala mi błąd, że takie rzeczy jak INSERT INTO czy właśnie SHOW, bo otrzymuję: [Syntax Error] line 0, col 0: Error: Expected SELECT, UPDATE or DELETE, got 'SHOW' Ten post edytował Szymciosek 13.10.2012, 14:00:58 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 18.10.2025 - 01:45 |