-
Notifications
You must be signed in to change notification settings - Fork 280
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Bulk property assignment #699
Comments
Hey there, How is that different from R::import or this ? $book = R::dispense( [
'_type' => 'book',
'title' => 'Gifted Programmers',
'author' => [ '_type' => 'author', 'name' => 'Xavier' ],
'ownPageList' => [ ['_type'=>'page', 'text' => '...'] ]
] ); |
Hmm, good point! |
@benmajor Just to add that you could also use /**
* Converts a series of rows to beans.
* This method converts a series of rows to beans.
* The type of the desired output beans can be specified in the
* first parameter. The second parameter is meant for the database
* result rows.
*
* Usage:
*
* <code>
* $rows = R::getAll( 'SELECT * FROM ...' )
* $beans = R::convertToBeans( $rows );
* </code>
*
* As of version 4.3.2 you can specify a meta-mask.
* Data from columns with names starting with the value specified in the mask
* will be transferred to the meta section of a bean (under data.bundle).
*
* <code>
* $rows = R::getAll( 'SELECT FROM... COUNT(*) AS extra_count ...' );
* $beans = R::convertToBeans( $rows );
* $bean = reset( $beans );
* $data = $bean->getMeta( 'data.bundle' );
* $extra_count = $data['extra_count'];
* </code>
*
* New in 4.3.2: meta mask. The meta mask is a special mask to send
* data from raw result rows to the meta store of the bean. This is
* useful for bundling additional information with custom queries.
* Values of every column whos name starts with $mask will be
* transferred to the meta section of the bean under key 'data.bundle'.
*
* @param string $type type of beans to produce
* @param array $rows must contain an array of array
* @param string $metamask meta mask to apply (optional)
*
* @return array
*/
public static function convertToBeans( $type, $rows, $metamask = NULL ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there any chance of adding something like the following to the roadmap? It would certainly be helpful in lots of instances (not least of which is importing existing data or CSVs, or similar):
The text was updated successfully, but these errors were encountered: