This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoadMediaData extends AbstractFixture implements OrderedFixtureInterface | |
{ | |
public function load(ObjectManager $manager) | |
{ | |
$certification = new Certification(); | |
$certification->setCode('PG-13'); | |
$manager->persist($certification); | |
$person = new Person(); | |
$person->setName('Test person'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctrine: | |
dbal: | |
driver: pdo_mysql | |
host: localhost | |
port: | |
dbname: db_test | |
user: user | |
password: pass | |
charset: UTF8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /path/to/your/project | |
php app/console doctrine:schema:drop --env test --force | |
php app/console doctrine:schema:create --env test | |
php app/console doctrine:fixtures:load --env test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function acmeAction() | |
{ | |
$acme = new Acme(); | |
$form = $this->get('form.factory') | |
->createNamedBuilder(new AcmeType(), 'acme_form', $acme) | |
->getForm(); | |
$request = $this->getRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AcmeProvider extends ContentProvider { | |
@Override | |
public int delete(Uri uri, String selection, String[] selectionArgs) { | |
// TODO Auto-generated method stub | |
return 0; | |
} | |
@Override | |
public String getType(Uri uri) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Authority and ContentProvier URI | |
public static final String AUTHORITY = "com.acme.provider.myapp"; | |
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/logs"); | |
//differentiate between the different URI requests | |
private static final int LOG_LIST = 1; | |
private static final int LOG_ITEM = 2; | |
//content types | |
private static final String CONTENT_TYPE_LIST = "vnd.android.cursor.dir/vnd.myapp.logs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class AcmeDatabaseHelper extends SQLiteOpenHelper { | |
private static final String CREATE_TABLE = | |
"create table " | |
+ TABLE_NAME + " (" | |
+ KEY_ID + " integer primary key autoincrement, " | |
+ KEY_FILENAME + " TEXT" | |
+ ");"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public String getType(Uri uri) { | |
switch (uriMatcher.match(uri)) { | |
case LOG_LIST: return CONTENT_TYPE_LIST; | |
case LOG_ITEM: return CONTENT_TYPE_ITEM; | |
default: throw new IllegalArgumentException("Unsupported URI: " + uri); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreate() { | |
Context context = getContext(); | |
AcmeDatabaseHelper helper = new AcmeDatabaseHelper(context); | |
dbLogs = helper.getWritableDatabase(); | |
return dbLogs == null ? false : true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public int delete(Uri uri, String selection, String[] selectionArgs) { | |
int count; | |
switch (uriMatcher.match(uri)) { | |
case LOG_LIST: | |
count = dbLogs.delete(TABLE_NAME, selection, selectionArgs); | |
break; | |
case LOG_ITEM: | |
String segment = uri.getPathSegments().get(1); |
OlderNewer