0

I want to be about to create a redbeanPHP bean without initializing the bean, here is an example:

 //create bean sample data as a table in a database 
 $sampledata = R::dispense('sampledata');

 //Create column
 $sampledata->slotName = "John Doe"; //TEXT

So my question, Is it possible to create a Text bean - slotName without populating the column with "John Doe"

Anthony
  • 41
  • 1
  • 5
  • Why should you want this? A bean represents a row in the database, so I think that once there isn't a row, there also is no bean. This the same for types. – George Boot Feb 07 '14 at 13:21
  • I know that a bean represents a row (do you mean `Table` ?) in the DB but its can also represent the columns on that table. – Anthony Feb 10 '14 at 14:56
  • Imagine i want to a clean table with specific data types in Redbeanphp. how do i achieve that with out creating an example under that bean? – Anthony Feb 10 '14 at 14:58
  • I think you can not. RedBeanPHP adds support to auto create the database table for you, but it still isn't a tool to create tables with. – George Boot Feb 10 '14 at 16:06
  • here is a sample trick i got from my devteam `$sampledata = R::dispense('sampledata');` //create table `$sampledata->slotName = "John Doe"; ` // that will create a column on the table as Text data type. then we truncate the table after creating the data type `R::wipe($sampledata)` – Anthony Feb 11 '14 at 16:27
  • I know am not an expert in redbeanPHP but that will solve the problem. Also there is a ref to this [link](http://stackoverflow.com/questions/4347970/empty-or-truncate-table-with-redbean-php) as to truncating a table. – Anthony Feb 11 '14 at 16:32

0 Answers0