Reputation: 4271
I'm using Propel two, I want to be able to select the value of one column in a given table, the equivalent raw SQL query looks like this:
select author_id from book_authors WHERE book_id = 111;
If I write
BookAuthorsQuery::create()->findByAuthorId(111);
I will get an array objects containing all the fields that the table has, but i just one an array containing the values of my selected column.
Upvotes: 2
Views: 6808
Reputation: 433
this get the value! on
$authorId = BookAuthorsQuery::create()->select(['author_id'])->findOneByAuthorId(111);
Upvotes: 0
Reputation: 2629
Try this:
BookAuthorsQuery::create()->select(array('author_id'))->findByBookId(111);
the ->select(array('author_id'))
in the propel query gives propel an array of fields you would like to select from your table.
Upvotes: 9